mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-07 13:41:35 +00:00
*: Format with rustfmt (#2188)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
@ -27,16 +27,22 @@ use std::fmt;
|
||||
#[derive(Debug)]
|
||||
pub struct DecodingError {
|
||||
msg: String,
|
||||
source: Option<Box<dyn Error + Send + Sync>>
|
||||
source: Option<Box<dyn Error + Send + Sync>>,
|
||||
}
|
||||
|
||||
impl DecodingError {
|
||||
pub(crate) fn new<S: ToString>(msg: S) -> Self {
|
||||
Self { msg: msg.to_string(), source: None }
|
||||
Self {
|
||||
msg: msg.to_string(),
|
||||
source: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn source(self, source: impl Error + Send + Sync + 'static) -> Self {
|
||||
Self { source: Some(Box::new(source)), .. self }
|
||||
Self {
|
||||
source: Some(Box::new(source)),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,17 +62,23 @@ impl Error for DecodingError {
|
||||
#[derive(Debug)]
|
||||
pub struct SigningError {
|
||||
msg: String,
|
||||
source: Option<Box<dyn Error + Send + Sync>>
|
||||
source: Option<Box<dyn Error + Send + Sync>>,
|
||||
}
|
||||
|
||||
/// An error during encoding of key material.
|
||||
impl SigningError {
|
||||
pub(crate) fn new<S: ToString>(msg: S) -> Self {
|
||||
Self { msg: msg.to_string(), source: None }
|
||||
Self {
|
||||
msg: msg.to_string(),
|
||||
source: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn source(self, source: impl Error + Send + Sync + 'static) -> Self {
|
||||
Self { source: Some(Box::new(source)), .. self }
|
||||
Self {
|
||||
source: Some(Box::new(source)),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,4 +93,3 @@ impl Error for SigningError {
|
||||
self.source.as_ref().map(|s| &**s as &dyn Error)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user