WrapIoError

Trait WrapIoError 

Source
pub trait WrapIoError<PathType: PathType + ?Sized>: Sized + Sealed {
    type Output;

    // Required method
    fn wrap_io_error(
        self,
        get_path: impl FnOnce() -> PathType::OwnedPath,
    ) -> Result<Self::Output, PathType::OwnedPath>;

    // Provided method
    fn wrap_io_error_with(
        self,
        path: &PathType,
    ) -> Result<Self::Output, PathType::OwnedPath> { ... }
}
Expand description

A trait for wrapping IO errors with the path where they happened, turning std::io::Results into crate::error::Results.

Required Associated Types§

Source

type Output

The inner type.

Required Methods§

Source

fn wrap_io_error( self, get_path: impl FnOnce() -> PathType::OwnedPath, ) -> Result<Self::Output, PathType::OwnedPath>

Wrap the IO error with the path where it happened.

Provided Methods§

Source

fn wrap_io_error_with( self, path: &PathType, ) -> Result<Self::Output, PathType::OwnedPath>

Wrap the IO error with the given path.

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, P: PathType + ?Sized> WrapIoError<P> for Result<T>

Source§

type Output = T

Source§

fn wrap_io_error( self, get_path: impl FnOnce() -> P::OwnedPath, ) -> Result<Self::Output, P::OwnedPath>

Implementors§