Enum rkyv::result::ArchivedResult

source ·
#[repr(u8)]
pub enum ArchivedResult<T, E> { Ok(T), Err(E), }
Expand description

An archived Result that represents either success (Ok) or failure (Err).

Variants§

§

Ok(T)

Contains the success value

§

Err(E)

Contains the error value

Implementations§

source§

impl<T, E> ArchivedResult<T, E>

source

pub fn ok(self) -> Option<T>

Converts from ArchivedResult<T, E> to Option<T>.

source

pub fn unwrap(self) -> T

Returns the contained Ok value, consuming the self value.

source

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

Returns the contained Ok value or computes it from a closure.

source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

source

pub fn as_ref(&self) -> Result<&T, &E>

Returns a Result containing the success and error values of this ArchivedResult.

source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut ArchivedResult<T, E> to Result<&mut T, &mut E>.

source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the possibly contained value.

The iterator yields one value if the result is ArchivedResult::Ok, otherwise none.

source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the possibly contained value.

The iterator yields one value if the result is ArchivedResult::Ok, otherwise none.

source§

impl<T: Deref, E> ArchivedResult<T, E>

source

pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E>

Converts from &ArchivedResult<T, E> to Result<&<T as Deref>::Target, &E>.

Coerces the Ok variant of the original ArchivedResult via Deref and returns the new Result.

source§

impl<T: DerefMut, E> ArchivedResult<T, E>

source

pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E>

Converts from &mut ArchivedResult<T, E> to Result<&mut <T as Deref>::Target, &mut E>.

Coerces the Ok variant of the original ArchivedResult via DerefMut and returns the new Result.

Trait Implementations§

source§

impl<__C: ?Sized, T, E> CheckBytes<__C> for ArchivedResult<T, E>
where T: CheckBytes<__C>, E: CheckBytes<__C>,

§

type Error = EnumCheckError<u8>

The error that may result from checking the type.
source§

unsafe fn check_bytes<'__bytecheck>( value: *const Self, context: &mut __C, ) -> Result<&'__bytecheck Self, EnumCheckError<u8>>

Checks whether the given pointer points to a valid value within the given context. Read more
source§

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

source§

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

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

impl<T, E, D> Deserialize<Result<T, E>, D> for ArchivedResult<T::Archived, E::Archived>
where T: Archive, E: Archive, D: Fallible + ?Sized, T::Archived: Deserialize<T, D>, E::Archived: Deserialize<E, D>,

source§

fn deserialize(&self, deserializer: &mut D) -> Result<Result<T, E>, D::Error>

Deserializes using the given deserializer
source§

impl<T: Hash, E: Hash> Hash for ArchivedResult<T, E>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Ord, E: Ord> Ord for ArchivedResult<T, E>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq<U>, U, E: PartialEq<F>, F> PartialEq<ArchivedResult<T, E>> for Result<U, F>

source§

fn eq(&self, other: &ArchivedResult<T, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, U: PartialEq<T>, E, F: PartialEq<E>> PartialEq<Result<T, E>> for ArchivedResult<U, F>

source§

fn eq(&self, other: &Result<T, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialEq, E: PartialEq> PartialEq for ArchivedResult<T, E>

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd, E: PartialOrd> PartialOrd for ArchivedResult<T, E>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: Eq, E: Eq> Eq for ArchivedResult<T, E>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T, E> UnwindSafe for ArchivedResult<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> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> CallHasher for T
where T: Hash + ?Sized,

source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
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> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
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.