Expand description
§Module :: error_tools
Basic exceptions handling mechanism.
§Basic use-case
ⓘ
#[ cfg( feature = "enabled" ) ]
fn main()
{
let err = f1();
println!( "{err:#?}" );
// < Err(
// < BasicError {
// < msg: "Some error",
// < },
// < )
}
#[ cfg( feature = "enabled" ) ]
fn f1() -> error_tools::untyped::Result< () >
{
let _read = std::fs::read_to_string( "Cargo.toml" )?;
Err( error_tools::BasicError::new( "Some error" ).into() )
}
§To add to your project
cargo add error_tools
§Try out from the repository
git clone https://github.com/Wandalen/wTools
cd wTools
cargo run --example error_tools_trivial
Re-exports§
pub use super::super::error;
pub use super::super::untyped;
pub use super::super::untyped as for_app;
pub use super::super::typed;
pub use super::super::typed as for_lib;
pub use super::assert;
pub use super::typed;
pub use super::untyped;
Modules§
- dependency
- Namespace with dependencies.
- error
- Alias for
std::error::BasicError
. - exposed
- Exposed namespace of the module.
- orphan
- Shared with parent namespace of the module
- own
- Own namespace of the module.
- prelude
- Prelude to use essentials:
use my_module::prelude::*
. - thiserror
- github crates-io docs-rs
Macros§
- debug_
assert_ id - Macro asserts that two expressions are identical to each other. Unlike
std::assert_eq
it is removed from a release build. - debug_
assert_ identical - Macro asserts that two expressions are identical to each other. Unlike
std::assert_eq
it is removed from a release build. Alias ofdebug_assert_id
. - debug_
assert_ ni - Macro asserts that two expressions are not identical to each other. Unlike
std::assert_eq
it is removed from a release build. - debug_
assert_ not_ identical - Macro asserts that two expressions are not identical to each other. Unlike
std::assert_eq
it is removed from a release build.
Traits§
- ErrWith
- This trait allows adding extra context or information to an error, creating a tuple of the additional context and the original error. This is particularly useful for error handling when you want to include more details in the error without losing the original error value.
- Error
Trait Error
is a trait representing the basic expectations for error values, i.e., values of typeE
inResult<T, E>
.
Type Aliases§
- Result
With Report - A type alias for a
Result
that contains an error which is a tuple of a report and an original error.