[−][src]Trait witcher::Wrapper
Define the wrap
function for Result types
Required methods
pub fn pass(self) -> Result<T>
[src]
Pass the error through without any message. This is useful to keep compatibility without having to unwrap the error.
pub fn wrap(self, msg: &str) -> Result<T>
[src]
Wrap the error providing the ability to add more context
pub fn err_is<U>(&self) -> bool where
U: StdError + 'static,
[src]
U: StdError + 'static,
Check if there is an error and the err is the given error type
pub fn retry<F>(self, max: usize, f: F) -> Result<T, E> where
F: Fn(usize) -> Result<T, E>,
[src]
F: Fn(usize) -> Result<T, E>,
Retry the given function when we have an error max
number of times.
pub fn retry_on<F>(self, max: usize, id: TypeId, f: F) -> Result<T, E> where
F: Fn(usize) -> Result<T, E>,
[src]
F: Fn(usize) -> Result<T, E>,
Retry the given function when we have the concreate error U
max
number of times.
Implementors
impl<T, E> Wrapper<T, E> for Result<T, E> where
E: StdError + Send + Sync + 'static,
[src]
E: StdError + Send + Sync + 'static,
pub fn pass(self) -> Result<T>
[src]
pub fn wrap(self, msg: &str) -> Result<T>
[src]
pub fn err_is<U>(&self) -> bool where
U: StdError + 'static,
[src]
U: StdError + 'static,
pub fn retry<F>(self, max: usize, f: F) -> Result<T, E> where
F: Fn(usize) -> Result<T, E>,
[src]
F: Fn(usize) -> Result<T, E>,
pub fn retry_on<F>(self, max: usize, id: TypeId, f: F) -> Result<T, E> where
F: Fn(usize) -> Result<T, E>,
[src]
F: Fn(usize) -> Result<T, E>,