Skip to content

Commit 744d85b

Browse files
committed
Box the cases to make the struct size not completely insane
1 parent 11a8d0e commit 744d85b

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/get/error.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,41 @@ pub enum IoCases {
108108
pub enum GetError {
109109
/// Hash not found, or a requested chunk for the hash not found.
110110
#[snafu(display("Data for hash not found"))]
111-
NotFound { source: NotFoundCases },
111+
NotFound {
112+
#[snafu(source(from(NotFoundCases, Box::new)))]
113+
source: Box<NotFoundCases>,
114+
},
112115
/// Remote has reset the connection.
113116
#[snafu(display("Remote has reset the connection"))]
114-
RemoteReset { source: RemoteResetCases },
117+
RemoteReset {
118+
#[snafu(source(from(RemoteResetCases, Box::new)))]
119+
source: Box<RemoteResetCases>,
120+
},
115121
/// Remote behaved in a non-compliant way.
116122
#[snafu(display("Remote behaved in a non-compliant way"))]
117-
NoncompliantNode { source: NoncompliantNodeCases },
123+
NoncompliantNode {
124+
#[snafu(source(from(NoncompliantNodeCases, Box::new)))]
125+
source: Box<NoncompliantNodeCases>,
126+
},
118127

119128
/// Network or IO operation failed.
120129
#[snafu(display("A network or IO operation failed"))]
121-
Io { source: IoCases },
122-
130+
Io {
131+
#[snafu(source(from(IoCases, Box::new)))]
132+
source: Box<IoCases>,
133+
},
123134
/// Our download request is invalid.
124135
#[snafu(display("Our download request is invalid"))]
125-
BadRequest { source: BadRequestCases },
136+
BadRequest {
137+
#[snafu(source(from(BadRequestCases, Box::new)))]
138+
source: Box<BadRequestCases>,
139+
},
126140
/// Operation failed on the local node.
127141
#[snafu(display("Operation failed on the local node"))]
128-
LocalFailure { source: LocalFailureCases },
142+
LocalFailure {
143+
#[snafu(source(from(LocalFailureCases, Box::new)))]
144+
source: Box<LocalFailureCases>,
145+
},
129146
}
130147

131148
pub type GetResult<T> = std::result::Result<T, GetError>;

0 commit comments

Comments
 (0)