Struct cranelift_codegen::packed_option::PackedOption [−][src]
Packed representation of Option<T>
.
Implementations
impl<T> PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
pub fn is_none(&self) -> bool
[src]
Returns true
if the packed option is a None
value.
pub fn is_some(&self) -> bool
[src]
Returns true
if the packed option is a Some
value.
pub fn expand(self) -> Option<T>
[src]
Expand the packed option into a normal Option
.
pub fn map<U, F>(self, f: F) -> Option<U> where
F: FnOnce(T) -> U,
[src]
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]
Unwrap a packed Some
value or panic.
pub fn expect(self, msg: &str) -> T
[src]
Unwrap a packed Some
value or panic.
pub fn take(&mut self) -> Option<T>
[src]
Takes the value out of the packed option, leaving a None
in its place.
Trait Implementations
impl<T> Clone for PackedOption<T> where
T: Clone + ReservedValue,
[src]
T: Clone + ReservedValue,
pub fn clone(&self) -> PackedOption<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Copy for PackedOption<T> where
T: Copy + ReservedValue,
[src]
T: Copy + ReservedValue,
impl<T> Debug for PackedOption<T> where
T: ReservedValue + Debug,
[src]
T: ReservedValue + Debug,
impl<T> Default for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
pub fn default() -> PackedOption<T>
[src]
Create a default packed option representing None
.
impl<T> Eq for PackedOption<T> where
T: Eq + ReservedValue,
[src]
T: Eq + ReservedValue,
impl<T> From<Option<T>> for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
pub fn from(opt: Option<T>) -> PackedOption<T>
[src]
Convert an option into its packed equivalent.
impl<T> From<T> for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
pub fn from(t: T) -> PackedOption<T>
[src]
Convert t
into a packed Some(x)
.
impl<T> Hash for PackedOption<T> where
T: Hash + ReservedValue,
[src]
T: Hash + ReservedValue,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Into<Option<T>> for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
impl<T> Ord for PackedOption<T> where
T: Ord + ReservedValue,
[src]
T: Ord + ReservedValue,
pub fn cmp(&self, other: &PackedOption<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T> PartialEq<PackedOption<T>> for PackedOption<T> where
T: PartialEq<T> + ReservedValue,
[src]
T: PartialEq<T> + ReservedValue,
pub fn eq(&self, other: &PackedOption<T>) -> bool
[src]
pub fn ne(&self, other: &PackedOption<T>) -> bool
[src]
impl<T> PartialOrd<PackedOption<T>> for PackedOption<T> where
T: PartialOrd<T> + ReservedValue,
[src]
T: PartialOrd<T> + ReservedValue,
pub fn partial_cmp(&self, other: &PackedOption<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> StructuralEq for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
impl<T> StructuralPartialEq for PackedOption<T> where
T: ReservedValue,
[src]
T: ReservedValue,
Auto Trait Implementations
impl<T> RefUnwindSafe for PackedOption<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for PackedOption<T> where
T: Send,
T: Send,
impl<T> Sync for PackedOption<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PackedOption<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PackedOption<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
[src]
T: Hash,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,