Skip to content

Commit

Permalink
fix!: box Error::RequestError variant
Browse files Browse the repository at this point in the history
This lowers the size of `Error` from 252 to 48 bytes on 64bit systems.
  • Loading branch information
martinohmann committed Apr 9, 2024
1 parent 4ec7527 commit c77ee4c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum Error {

/// Represents an error fetching a remote data source.
#[error("unable to fetch remote data source")]
RequestError(#[from] ureq::Error),
RequestError(Box<ureq::Error>),

/// Represents errors emitted by serializers and deserializers.
#[error(transparent)]
Expand Down Expand Up @@ -159,3 +159,9 @@ impl From<hcl::Error> for Error {
}
}
}

impl From<ureq::Error> for Error {
fn from(err: ureq::Error) -> Self {
Error::RequestError(Box::new(err))
}
}

0 comments on commit c77ee4c

Please sign in to comment.