pub enum ErrorBoundary<T> {
Err(Arc<dyn Error + Send + Sync + 'static>),
Ok(T),
}
Expand description
Wraps a serialization / deserialization result to prevent error from bubbling up.
This is useful for keeping errors in an experimental part of a schema contained.
Variants§
Err(Arc<dyn Error + Send + Sync + 'static>)
Contains the error value.
Ok(T)
Contains the success value.
Implementations§
source§impl<T> ErrorBoundary<T>
impl<T> ErrorBoundary<T>
sourcepub fn as_ref(&self) -> ErrorBoundary<&T>
pub fn as_ref(&self) -> ErrorBoundary<&T>
Converts from ErrorBoundary<T>
to ErrorBoundary<&T>
.
sourcepub fn unwrap_or_else<F>(self, op: F) -> T
pub fn unwrap_or_else<F>(self, op: F) -> T
Returns the contained Ok
value or computes it from a closure.
sourcepub fn get_or_insert_with<F>(&mut self, f: F) -> &mut Twhere
F: FnOnce() -> T,
pub fn get_or_insert_with<F>(&mut self, f: F) -> &mut Twhere
F: FnOnce() -> T,
Inserts a value computed from f
into the error boundary if it is Err
,
then returns a mutable reference to the contained value.
Trait Implementations§
source§impl<T: Clone> Clone for ErrorBoundary<T>
impl<T: Clone> Clone for ErrorBoundary<T>
source§fn clone(&self) -> ErrorBoundary<T>
fn clone(&self) -> ErrorBoundary<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for ErrorBoundary<T>
impl<T: Debug> Debug for ErrorBoundary<T>
source§impl<T> Default for ErrorBoundary<T>where
T: Default,
impl<T> Default for ErrorBoundary<T>where
T: Default,
source§impl<'de, T> Deserialize<'de> for ErrorBoundary<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ErrorBoundary<T>where
T: Deserialize<'de>,
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for ErrorBoundary<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ErrorBoundary<T>
impl<T> Send for ErrorBoundary<T>where
T: Send,
impl<T> Sync for ErrorBoundary<T>where
T: Sync,
impl<T> Unpin for ErrorBoundary<T>where
T: Unpin,
impl<T> !UnwindSafe for ErrorBoundary<T>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)