pub struct SanthErrorBuilder<State = NoFix> { /* private fields */ }Expand description
Builder for SanthError.
Uses a typestate pattern to enforce at compile time that .fix() is
called before .build().
Implementations§
Source§impl<State> SanthErrorBuilder<State>
impl<State> SanthErrorBuilder<State>
Sourcepub fn with_context(
self,
key: impl Into<Cow<'static, str>>,
value: impl Display,
) -> Self
pub fn with_context( self, key: impl Into<Cow<'static, str>>, value: impl Display, ) -> Self
Add a key-value diagnostic context entry.
Sourcepub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Self
Attach a source error to the cause chain.
Sourcepub fn with_location(self, location: ErrorLocation) -> Self
pub fn with_location(self, location: ErrorLocation) -> Self
Attach a location to the error.
Source§impl SanthErrorBuilder<HasFix>
impl SanthErrorBuilder<HasFix>
Sourcepub fn build(self) -> SanthError
pub fn build(self) -> SanthError
Build the SanthError.
A fix hint that does not already start with "Fix: " is normalised by
prefixing it, so the built error always upholds the "Fix: " contract.
This never panics.
Trait Implementations§
Auto Trait Implementations§
impl<State = NoFix> !RefUnwindSafe for SanthErrorBuilder<State>
impl<State = NoFix> !UnwindSafe for SanthErrorBuilder<State>
impl<State> Freeze for SanthErrorBuilder<State>
impl<State> Send for SanthErrorBuilder<State>where
State: Send,
impl<State> Sync for SanthErrorBuilder<State>where
State: Sync,
impl<State> Unpin for SanthErrorBuilder<State>where
State: Unpin,
impl<State> UnsafeUnpin for SanthErrorBuilder<State>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more