Struct cranelift_codegen::packed_option::PackedOption [−][src]
pub struct PackedOption<T>(_)
where
T: ReservedValue;
Packed representation of Option<T>
.
Methods
impl<T> PackedOption<T> where
T: ReservedValue,
[src]
impl<T> PackedOption<T> where
T: ReservedValue,
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> Into<Option<T>> for PackedOption<T> where
T: ReservedValue,
[src]
impl<T> Into<Option<T>> for PackedOption<T> where
T: ReservedValue,
impl<T> PartialOrd<PackedOption<T>> for PackedOption<T> where
T: ReservedValue + PartialOrd<T>,
[src]
impl<T> PartialOrd<PackedOption<T>> for PackedOption<T> where
T: ReservedValue + PartialOrd<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> Hash for PackedOption<T> where
T: ReservedValue + Hash,
[src]
impl<T> Hash for PackedOption<T> where
T: ReservedValue + Hash,
fn hash<__HT>(&self, state: &mut __HT) where
__HT: Hasher,
[src]
fn hash<__HT>(&self, state: &mut __HT) where
__HT: Hasher,
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> Clone for PackedOption<T> where
T: ReservedValue + Clone,
[src]
impl<T> Clone for PackedOption<T> where
T: ReservedValue + Clone,
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> Default for PackedOption<T> where
T: ReservedValue,
[src]
impl<T> Default for PackedOption<T> where
T: ReservedValue,
fn default() -> PackedOption<T>
[src]
fn default() -> PackedOption<T>
Create a default packed option representing None
.
impl<T> Debug for PackedOption<T> where
T: ReservedValue + Debug,
[src]
impl<T> Debug for PackedOption<T> where
T: ReservedValue + Debug,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<T> Copy for PackedOption<T> where
T: ReservedValue + Copy,
[src]
impl<T> Copy for PackedOption<T> where
T: ReservedValue + Copy,
impl<T> Ord for PackedOption<T> where
T: ReservedValue + Ord,
[src]
impl<T> Ord for PackedOption<T> where
T: ReservedValue + Ord,
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> Eq for PackedOption<T> where
T: ReservedValue + Eq,
[src]
impl<T> Eq for PackedOption<T> where
T: ReservedValue + Eq,
impl<T> PartialEq<PackedOption<T>> for PackedOption<T> where
T: ReservedValue + PartialEq<T>,
[src]
impl<T> PartialEq<PackedOption<T>> for PackedOption<T> where
T: ReservedValue + PartialEq<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> From<Option<T>> for PackedOption<T> where
T: ReservedValue,
[src]
impl<T> From<Option<T>> for PackedOption<T> where
T: ReservedValue,
fn from(opt: Option<T>) -> PackedOption<T>
[src]
fn from(opt: Option<T>) -> PackedOption<T>
Convert an option into its packed equivalent.
impl<T> From<T> for PackedOption<T> where
T: ReservedValue,
[src]
impl<T> From<T> for PackedOption<T> where
T: ReservedValue,
fn from(t: T) -> PackedOption<T>
[src]
fn from(t: T) -> PackedOption<T>
Convert t
into a packed Some(x)
.
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,