WithContext

Trait WithContext 

Source
pub trait WithContext<T> {
    // Required methods
    fn with_context<F>(self, f: F) -> Result<T, RusTorchError>
       where F: FnOnce() -> ErrorContext;
    fn with_operation(self, operation: &str) -> Result<T, RusTorchError>;
}
Expand description

Trait for adding context to errors エラーにコンテキストを追加するトレイト

Required Methods§

Source

fn with_context<F>(self, f: F) -> Result<T, RusTorchError>
where F: FnOnce() -> ErrorContext,

Add context to the error エラーにコンテキストを追加

Source

fn with_operation(self, operation: &str) -> Result<T, RusTorchError>

Add simple operation context 簡単な操作コンテキストを追加

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, E> WithContext<T> for Result<T, E>
where E: Into<RusTorchError>,

Source§

fn with_context<F>(self, f: F) -> Result<T, RusTorchError>
where F: FnOnce() -> ErrorContext,

Source§

fn with_operation(self, operation: &str) -> Result<T, RusTorchError>

Implementors§