pub trait Access<T>: InferPresence<T> {
type RemainderFrom<Source: Access<T>>: Access<T>;
const IS_ABSENT: bool;
// Required methods
fn get(&self) -> Option<&T>;
fn get_mut(&mut self) -> Option<&mut T>;
fn into_option(self) -> Option<T>;
fn from_value(value: T) -> (Self, Self::RemainderFrom<T>)
where Self: Sized;
fn try_from_option(
value: Option<T>,
) -> Result<(Self, Self::RemainderFrom<Option<T>>), Option<T>>
where Self: Sized;
}Expand description
Uniform field access for Present, Optional, or Absent.
Required Associated Constants§
Required Associated Types§
Sourcetype RemainderFrom<Source: Access<T>>: Access<T>
type RemainderFrom<Source: Access<T>>: Access<T>
Remainder type when extracting Self from Source.
Required Methods§
Sourcefn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Consume and convert to Option.
Sourcefn from_value(value: T) -> (Self, Self::RemainderFrom<T>)where
Self: Sized,
fn from_value(value: T) -> (Self, Self::RemainderFrom<T>)where
Self: Sized,
Construct from a value.
Sourcefn try_from_option(
value: Option<T>,
) -> Result<(Self, Self::RemainderFrom<Option<T>>), Option<T>>where
Self: Sized,
fn try_from_option(
value: Option<T>,
) -> Result<(Self, Self::RemainderFrom<Option<T>>), Option<T>>where
Self: Sized,
Try to construct from an option.
§Errors
Returns Err with the original Option<T> if the conversion cannot be performed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".