Skip to main content

ProblemResult

Trait ProblemResult 

Source
pub trait ProblemResult<OkT> {
Show 13 methods // Required methods fn via<ErrorT>(self, error: ErrorT) -> Result<OkT, Problem> where ErrorT: 'static + Error + Send + Sync; fn map_via<ErrorT, FromT>(self, from: FromT) -> Result<OkT, Problem> where ErrorT: 'static + Error + Send + Sync, FromT: FnOnce() -> ErrorT; fn with<AttachmentT>(self, attachment: AttachmentT) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync; fn map_with<AttachmentT, FromT>(self, from: FromT) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> AttachmentT; fn with_once<AttachmentT>( self, attachment: AttachmentT, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync; fn map_with_once<AttachmentT, FromT>( self, from: FromT, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> AttachmentT; fn maybe_with<AttachmentT>( self, attachment: Option<AttachmentT>, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync; fn maybe_map_with<AttachmentT, FromT>( self, from: FromT, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> Option<AttachmentT>; fn maybe_with_once<AttachmentT>( self, attachment: Option<AttachmentT>, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync; fn maybe_map_with_once<AttachmentT, FromT>( self, from: FromT, ) -> Result<OkT, Problem> where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> Option<AttachmentT>; fn with_location(self) -> Result<OkT, Problem>; fn with_backtrace(self) -> Result<OkT, Problem>; fn into_io_error(self) -> Result<OkT>;
}
Expand description

Problemo extensions for Result.

Required Methods§

Source

fn via<ErrorT>(self, error: ErrorT) -> Result<OkT, Problem>
where ErrorT: 'static + Error + Send + Sync,

Adds the error to the top of the causation chain.

Source

fn map_via<ErrorT, FromT>(self, from: FromT) -> Result<OkT, Problem>
where ErrorT: 'static + Error + Send + Sync, FromT: FnOnce() -> ErrorT,

Adds the error to the top of the causation chain.

Source

fn with<AttachmentT>(self, attachment: AttachmentT) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync,

Attach to the top cause.

Source

fn map_with<AttachmentT, FromT>(self, from: FromT) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> AttachmentT,

Attach to the top cause.

Source

fn with_once<AttachmentT>(self, attachment: AttachmentT) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync,

Attach to the top cause only if we don’t already have one of the same type.

Source

fn map_with_once<AttachmentT, FromT>(self, from: FromT) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> AttachmentT,

Attach to the top cause only if we don’t already have one of the same type.

Source

fn maybe_with<AttachmentT>( self, attachment: Option<AttachmentT>, ) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync,

Attach to the top cause if Some.

Source

fn maybe_map_with<AttachmentT, FromT>(self, from: FromT) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> Option<AttachmentT>,

Attach to the top cause.

Source

fn maybe_with_once<AttachmentT>( self, attachment: Option<AttachmentT>, ) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync,

Attach to the top cause if Some and we don’t already have one of the same type.

Source

fn maybe_map_with_once<AttachmentT, FromT>( self, from: FromT, ) -> Result<OkT, Problem>
where AttachmentT: Any + Send + Sync, FromT: FnOnce() -> Option<AttachmentT>,

Attach to the top cause if Some and we don’t already have one of the same type.

Source

fn with_location(self) -> Result<OkT, Problem>

Attach a Location (via Location::caller) if we don’t already have one.

Source

fn with_backtrace(self) -> Result<OkT, Problem>

Attach a backtrace to the top cause if we don’t already have one.

Source

fn into_io_error(self) -> Result<OkT>

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<ResultT, OkT> ProblemResult<OkT> for ResultT
where ResultT: IntoProblemResult<OkT>,