pub struct ZffError { /* private fields */ }Expand description
The main error-type of this crate.
Implementations
sourceimpl ZffError
impl ZffError
sourcepub fn new<S: Into<String>>(kind: ZffErrorKind, details: S) -> ZffError
pub fn new<S: Into<String>>(kind: ZffErrorKind, details: S) -> ZffError
Creates a new crate-related error.
Example
use zff::{ZffError, ZffErrorKind, Result};
fn my_func() -> Result<()> {
let custom_error = ZffError::new(
ZffErrorKind::Custom, "My detailed custom error message");
Err(custom_error)
}
fn main() {
match my_func() {
Err(x) => println!("It work's! Your custom error message is: {}", x),
_ => ()
}
}sourcepub fn new_custom<S: Into<String>>(details: S) -> ZffError
pub fn new_custom<S: Into<String>>(details: S) -> ZffError
Creates a new crate-related custom error.
Example
use zff::{ZffError, Result};
fn my_func() -> Result<()> {
let custom_error = ZffError::new_custom("My detailed custom error message");
Err(custom_error)
}
fn main() {
match my_func() {
Err(x) => println!("It work's! Your custom error message is: {}", x),
_ => ()
}
}sourcepub fn new_header_decode_error<S: Into<String>>(details: S) -> ZffError
pub fn new_header_decode_error<S: Into<String>>(details: S) -> ZffError
Creates a new crate-related header decode error.
Example
use zff::{ZffError, Result};
fn my_func() -> Result<()> {
let decode_error = ZffError::new_header_decode_error("error while trying to decode CompressionHeader from given data");
Err(decode_error)
}
fn main() {
match my_func() {
Err(x) => println!("It work's! Your custom error message is: {}", x),
_ => ()
}
}sourcepub fn get_kind(&self) -> &ZffErrorKind
pub fn get_kind(&self) -> &ZffErrorKind
Returns a reference to the kind.
Example
use zff::{ZffError, ZffErrorKind, Result};
fn my_func() -> Result<()> {
let custom_error = ZffError::new_custom("My detailed custom error message");
Err(custom_error)
}
fn main() {
match my_func() {
Err(x) => {
assert!(matches!(x.get_kind(), &ZffErrorKind::Custom));
},
_ => ()
}
}sourcepub fn unwrap_kind(self) -> ZffErrorKind
pub fn unwrap_kind(self) -> ZffErrorKind
returns the error kind and consumes self.
Example
use zff::{ZffError, ZffErrorKind, Result};
fn my_func() -> Result<()> {
let custom_error = ZffError::new_custom("My detailed custom error message");
Err(custom_error)
}
fn main() {
match my_func() {
Err(x) => {
assert!(matches!(x.unwrap_kind(), ZffErrorKind::Custom));
},
_ => ()
}
}Trait Implementations
sourceimpl From<ComponentRange> for ZffError
impl From<ComponentRange> for ZffError
sourcefn from(e: ComponentRangeError) -> ZffError
fn from(e: ComponentRangeError) -> ZffError
Converts to this type from the input type.
sourceimpl From<CryptoError> for ZffError
impl From<CryptoError> for ZffError
sourcefn from(e: PKCS5CryptoError) -> ZffError
fn from(e: PKCS5CryptoError) -> ZffError
Converts to this type from the input type.
sourceimpl From<DecodeError> for ZffError
impl From<DecodeError> for ZffError
sourcefn from(e: Base64DecodingError) -> ZffError
fn from(e: Base64DecodingError) -> ZffError
Converts to this type from the input type.
sourceimpl From<Error> for ZffError
impl From<Error> for ZffError
sourcefn from(e: EncryptionError) -> ZffError
fn from(e: EncryptionError) -> ZffError
Converts to this type from the input type.
sourceimpl From<Error> for ZffError
impl From<Error> for ZffError
sourcefn from(e: Ed25519Error) -> ZffError
fn from(e: Ed25519Error) -> ZffError
Converts to this type from the input type.
sourceimpl From<FromUtf8Error> for ZffError
impl From<FromUtf8Error> for ZffError
sourcefn from(e: FromUtf8Error) -> ZffError
fn from(e: FromUtf8Error) -> ZffError
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for ZffError
impl Send for ZffError
impl Sync for ZffError
impl Unpin for ZffError
impl !UnwindSafe for ZffError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more