Skip to main content

ConversionResultExt

Trait ConversionResultExt 

Source
pub trait ConversionResultExt<T> {
    // Required methods
    fn context(self, field: impl Into<String>) -> Result<T, ConversionError>;
    fn with_context<F, S>(self, field: F) -> Result<T, ConversionError>
       where F: FnOnce() -> S,
             S: Into<String>;
}

Required Methods§

Source

fn context(self, field: impl Into<String>) -> Result<T, ConversionError>

Adds a field path segment if the result is an error.

Source

fn with_context<F, S>(self, field: F) -> Result<T, ConversionError>
where F: FnOnce() -> S, S: Into<String>,

Computes and adds a field path segment only if the result is an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E> ConversionResultExt<T> for Result<T, E>
where E: Error + Send + Sync + 'static,

Source§

fn context(self, field: impl Into<String>) -> Result<T, ConversionError>

Source§

fn with_context<F, S>(self, field: F) -> Result<T, ConversionError>
where F: FnOnce() -> S, S: Into<String>,

Implementors§