Enum avr_oxide::oserror::OxideResult

source ·
pub enum OxideResult<T, E> {
    Ok(T),
    Err(E),
}
Expand description

A type used for returning and propagating errors; this implementation differs from core::result::Result by having an unwrap() implementation that doesn’t require Debug and importing a thousand dependencies we can’t afford on AVR.

Variants§

§

Ok(T)

§

Err(E)

Implementations§

source§

impl<T, E> OxideResult<T, E>

source

pub const fn is_ok(&self) -> bool

source

pub const fn is_err(&self) -> bool

source

pub fn unwrap(self) -> T

source

pub fn expect_err(self) -> E

source

pub fn unwrap_or(self, default: T) -> T

source

pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T

Trait Implementations§

source§

impl<T: Debug, E: Debug> Debug for OxideResult<T, E>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, E, F: From<E>> FromResidual<OxideResult<Infallible, E>> for OxideResult<T, F>

source§

fn from_residual(residual: OxideResult<Infallible, E>) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
source§

impl<T, E> Residual<T> for OxideResult<Infallible, E>

§

type TryType = OxideResult<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
source§

impl<T, E> Try for OxideResult<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = OxideResult<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more
source§

fn from_output(output: Self::Output) -> Self

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for OxideResult<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for OxideResult<T, E>

§

impl<T, E> Send for OxideResult<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for OxideResult<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for OxideResult<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for OxideResult<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.