pub struct CipherError { /* private fields */ }Expand description
Error returned by SegmentCipher implementations.
Deliberately minimal: the cipher operates on bytes, not files, so it has no
path or sequence context to carry. The segment I/O layer enriches this into
a crate::SegmentError::Cipher with the offending file’s path.
Construct with CipherError::msg for a plain message, or
CipherError::with_source when you want to preserve the underlying AEAD
(or other) error type for std::error::Error::source() chaining. The
fields are private so that adding context later is non-breaking.
Implementations§
Source§impl CipherError
impl CipherError
Sourcepub fn msg(message: impl Display) -> Self
pub fn msg(message: impl Display) -> Self
Construct a CipherError from anything displayable, with no
underlying cause.
Sourcepub fn with_source<E>(message: impl Display, source: E) -> Self
pub fn with_source<E>(message: impl Display, source: E) -> Self
Construct a CipherError that preserves the underlying error so
operators can inspect it via std::error::Error::source.
Use this when wrapping a typed error from an AEAD implementation
(aes_gcm::Error, chacha20poly1305::Error, …) so the original
failure is not erased behind a format!.
Trait Implementations§
Source§impl Clone for CipherError
impl Clone for CipherError
Source§fn clone(&self) -> CipherError
fn clone(&self) -> CipherError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CipherError
impl Debug for CipherError
Source§impl Display for CipherError
impl Display for CipherError
Source§impl Error for CipherError
impl Error for CipherError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()