Struct cranelift_entity::packed_option::PackedOption [−][src]
pub struct PackedOption<T: ReservedValue>(_);
Packed representation of Option<T>
.
Methods
impl<T: ReservedValue> PackedOption<T>
[src]
impl<T: ReservedValue> PackedOption<T>
pub fn is_none(&self) -> bool
[src]
pub fn is_none(&self) -> bool
Returns true
if the packed option is a None
value.
pub fn is_some(&self) -> bool
[src]
pub fn is_some(&self) -> bool
Returns true
if the packed option is a Some
value.
pub fn expand(self) -> Option<T>
[src]
pub fn expand(self) -> Option<T>
Expand the packed option into a normal Option
.
pub fn map<U, F>(self, f: F) -> Option<U> where
F: FnOnce(T) -> U,
[src]
pub fn map<U, F>(self, f: F) -> Option<U> where
F: FnOnce(T) -> U,
Maps a PackedOption<T>
to Option<U>
by applying a function to a contained value.
pub fn unwrap(self) -> T
[src]
pub fn unwrap(self) -> T
Unwrap a packed Some
value or panic.
pub fn expect(self, msg: &str) -> T
[src]
pub fn expect(self, msg: &str) -> T
Unwrap a packed Some
value or panic.
pub fn take(&mut self) -> Option<T>
[src]
pub fn take(&mut self) -> Option<T>
Takes the value out of the packed option, leaving a None
in its place.
Trait Implementations
impl<T: Clone + ReservedValue> Clone for PackedOption<T>
[src]
impl<T: Clone + ReservedValue> Clone for PackedOption<T>
fn clone(&self) -> PackedOption<T>
[src]
fn clone(&self) -> PackedOption<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Copy + ReservedValue> Copy for PackedOption<T>
[src]
impl<T: Copy + ReservedValue> Copy for PackedOption<T>
impl<T: PartialEq + ReservedValue> PartialEq for PackedOption<T>
[src]
impl<T: PartialEq + ReservedValue> PartialEq for PackedOption<T>
fn eq(&self, other: &PackedOption<T>) -> bool
[src]
fn eq(&self, other: &PackedOption<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PackedOption<T>) -> bool
[src]
fn ne(&self, other: &PackedOption<T>) -> bool
This method tests for !=
.
impl<T: PartialOrd + ReservedValue> PartialOrd for PackedOption<T>
[src]
impl<T: PartialOrd + ReservedValue> PartialOrd for PackedOption<T>
fn partial_cmp(&self, other: &PackedOption<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &PackedOption<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &PackedOption<T>) -> bool
[src]
fn lt(&self, other: &PackedOption<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &PackedOption<T>) -> bool
[src]
fn le(&self, other: &PackedOption<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &PackedOption<T>) -> bool
[src]
fn gt(&self, other: &PackedOption<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &PackedOption<T>) -> bool
[src]
fn ge(&self, other: &PackedOption<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Eq + ReservedValue> Eq for PackedOption<T>
[src]
impl<T: Eq + ReservedValue> Eq for PackedOption<T>
impl<T: Ord + ReservedValue> Ord for PackedOption<T>
[src]
impl<T: Ord + ReservedValue> Ord for PackedOption<T>
fn cmp(&self, other: &PackedOption<T>) -> Ordering
[src]
fn cmp(&self, other: &PackedOption<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: Hash + ReservedValue> Hash for PackedOption<T>
[src]
impl<T: Hash + ReservedValue> Hash for PackedOption<T>
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: ReservedValue> Default for PackedOption<T>
[src]
impl<T: ReservedValue> Default for PackedOption<T>
impl<T: ReservedValue> From<T> for PackedOption<T>
[src]
impl<T: ReservedValue> From<T> for PackedOption<T>
impl<T: ReservedValue> From<Option<T>> for PackedOption<T>
[src]
impl<T: ReservedValue> From<Option<T>> for PackedOption<T>
impl<T: ReservedValue> Into<Option<T>> for PackedOption<T>
[src]
impl<T: ReservedValue> Into<Option<T>> for PackedOption<T>
impl<T> Debug for PackedOption<T> where
T: ReservedValue + Debug,
[src]
impl<T> Debug for PackedOption<T> where
T: ReservedValue + Debug,
Auto Trait Implementations
impl<T> Send for PackedOption<T> where
T: Send,
impl<T> Send for PackedOption<T> where
T: Send,
impl<T> Sync for PackedOption<T> where
T: Sync,
impl<T> Sync for PackedOption<T> where
T: Sync,