Skip to main content

Present

Struct Present 

Source
pub struct Present;
Expand description

Marker indicating a field is present with a concrete value.

Trait Implementations§

Source§

impl Presence for Present

Source§

type OptionOrSelf = Present

Presence when combined with Option.
Source§

type Or<Other: Presence> = Present

Result of merging this presence with another.
Source§

type Output<T> = T

Container type (T, Option<T>, or PhantomData<T>).
Source§

fn or<T, Other: Presence>( self_: <Self as Presence>::Output<T>, _other: Other::Output<T>, ) -> <<Self as Presence>::Or<Other> as Presence>::Output<T>

Merge two values, preferring the first if present.
Source§

fn option_or_self<T>( option: Option<T>, self_: <Self as Presence>::Output<T>, ) -> <<Self as Presence>::OptionOrSelf as Presence>::Output<T>

Convert an Option into the appropriate presence state.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Access<T> for T

Source§

const IS_ABSENT: bool = const IS_ABSENT: bool = false;

Compile-time constant indicating if this field is absent.
Source§

type RemainderFrom<Source: Access<T>> = PhantomData<T>

Remainder type when extracting Self from Source.
Source§

fn get(&self) -> Option<&T>

Get field reference if present.
Source§

fn get_mut(&mut self) -> Option<&mut T>

Get mutable field reference if present.
Source§

fn into_option(self) -> Option<T>

Consume and convert to Option.
Source§

fn from_value(value: T) -> (T, <T as Access<T>>::RemainderFrom<T>)

Construct from a value.
Source§

fn try_from_option( value: Option<T>, ) -> Result<(T, <T as Access<T>>::RemainderFrom<Option<T>>), Option<T>>

Try to construct from an option. Read more
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, A> Extract<Option<T>, T> for A
where A: Access<T> + TryExtract<Option<T>, T>,

Source§

fn extract(self) -> (Option<T>, <Option<T> as Access<T>>::RemainderFrom<A>)

Extract a value into target type and remainder parts.
Source§

impl<T, A> Extract<PhantomData<T>, T> for A
where A: Access<T> + TryExtract<PhantomData<T>, T>,

Source§

fn extract( self, ) -> (PhantomData<T>, <PhantomData<T> as Access<T>>::RemainderFrom<A>)

Extract a value into target type and remainder parts.
Source§

impl<T> Extract<T, T> for T

Source§

fn extract(self) -> (T, <T as Access<T>>::RemainderFrom<T>)

Extract a value into target type and remainder parts.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InferPresence<T> for T

Source§

type Presence = Present

The presence state corresponding to this value type.
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, A> TryExtract<A, T> for T
where A: Access<T>,

Source§

fn try_extract(self) -> Result<(A, <A as Access<T>>::RemainderFrom<T>), T>

Try to extract a value into target type and remainder parts. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.