NodeContextExt

Trait NodeContextExt 

Source
pub trait NodeContextExt<T, Context>: Sized {
    type Error: Into<Box<dyn Error>>;

    // Required method
    fn with_node_context<Function, NewError>(
        self,
        ctx: &Context,
        f: Function,
    ) -> Result<T, NodeError>
       where Function: FnOnce(Self::Error) -> NewError,
             NewError: Into<Box<dyn Error>>;

    // Provided methods
    fn node_context(self, ctx: &Context) -> Result<T, NodeError> { ... }
    fn node_context_message(
        self,
        ctx: &Context,
        message: &str,
    ) -> Result<T, NodeError> { ... }
}

Required Associated Types§

Required Methods§

Source

fn with_node_context<Function, NewError>( self, ctx: &Context, f: Function, ) -> Result<T, NodeError>
where Function: FnOnce(Self::Error) -> NewError, NewError: Into<Box<dyn Error>>,

Provided Methods§

Source

fn node_context(self, ctx: &Context) -> Result<T, NodeError>

Source

fn node_context_message( self, ctx: &Context, message: &str, ) -> Result<T, NodeError>

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> NodeContextExt<T, NodeContextBase> for Option<T>

Source§

type Error = &'static str

Source§

fn with_node_context<Function, NewError>( self, ctx: &NodeContextBase, f: Function, ) -> Result<T, NodeError>
where Function: FnOnce(Self::Error) -> NewError, NewError: Into<Box<dyn Error>>,

Source§

fn node_context_message( self, ctx: &NodeContextBase, message: &str, ) -> Result<T, NodeError>

Source§

impl<T, E> NodeContextExt<T, NodeContextBase> for Result<T, E>
where E: Into<Box<dyn Error>>,

Source§

type Error = E

Source§

fn with_node_context<Function, NewError>( self, ctx: &NodeContextBase, f: Function, ) -> Result<T, NodeError>
where Function: FnOnce(Self::Error) -> NewError, NewError: Into<Box<dyn Error>>,

Source§

impl<T, E, NodeData, TraceData> NodeContextExt<T, NodeContext<NodeData, TraceData>> for Result<T, E>
where E: Into<Box<dyn Error>>, NodeData: NodeDataType, TraceData: TraceDataType,

Source§

type Error = E

Source§

fn with_node_context<Function, NewError>( self, ctx: &NodeContext<NodeData, TraceData>, f: Function, ) -> Result<T, NodeError>
where Function: FnOnce(Self::Error) -> NewError, NewError: Into<Box<dyn Error>>,

Source§

impl<T, NodeData, TraceData> NodeContextExt<T, NodeContext<NodeData, TraceData>> for Option<T>
where NodeData: NodeDataType, TraceData: TraceDataType,

Source§

type Error = &'static str

Source§

fn with_node_context<Function, NewError>( self, ctx: &NodeContext<NodeData, TraceData>, f: Function, ) -> Result<T, NodeError>
where Function: FnOnce(Self::Error) -> NewError, NewError: Into<Box<dyn Error>>,

Source§

fn node_context_message( self, ctx: &NodeContext<NodeData, TraceData>, message: &str, ) -> Result<T, NodeError>

Implementors§