Trait HandleError

Source
pub trait HandleError<Out = ()> {
    // Required method
    fn handle_error_with(
        self,
        error_handler: fn(_: BevyError, _: ErrorContext),
    ) -> impl Command;

    // Provided method
    fn handle_error(self) -> impl Command
       where Self: Sized { ... }
}
Expand description

Takes a Command that returns a Result and uses a given error handler function to convert it into a Command that internally handles an error if it occurs and returns ().

Required Methods§

Source

fn handle_error_with( self, error_handler: fn(_: BevyError, _: ErrorContext), ) -> impl Command

Takes a Command that returns a Result and uses a given error handler function to convert it into a Command that internally handles an error if it occurs and returns ().

Provided Methods§

Source

fn handle_error(self) -> impl Command
where Self: Sized,

Takes a Command that returns a Result and uses the default error handler function to convert it into a Command that internally handles an error if it occurs and returns ().

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.

Implementors§

Source§

impl<C> HandleError for C
where C: Command,

Source§

impl<C> HandleError<<fn() -> ! as FnRet>::Output> for C
where C: Command<<fn() -> ! as FnRet>::Output>,

Source§

impl<C, T, E> HandleError<Result<T, E>> for C
where C: Command<Result<T, E>>, E: Into<BevyError>,