pub struct ZffError { /* private fields */ }
Expand description

The main error-type of this crate.

Implementations

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),
		_ => ()
	}
}

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),
		_ => ()
	}
}

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),
		_ => ()
	}
}

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));
		},
		_ => ()
	}
}

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.