[−][src]Struct gvariant::MaybeFixedSize
Type with same representation as GVariant "mX" type where X is any fixed size type
This is the type returned by:
gv!("mb").cast(data); gv!("mi").cast(data); gv!("m(yi)").cast(data);
Rust's built in Option
doesn't have any specified byte representation so
we need our own type here.
Maybes are encoded differently depending on if their element type is
fixed-sized or not. MaybeNonFixedSize
is used when the contained size
is non-fixed, but it implements the same interface as this type
You probably just want to call .to_option()
on this type.
Implementations
impl<T: Cast> MaybeFixedSize<T>
[src]
pub fn to_option(&self) -> Option<&T>
[src]
Convert to a rust native Option
type.
Note: this doesn't copy the data, it returns an option to a reference to the underlying data.
Trait Implementations
impl<T: Cast> AlignOf for MaybeFixedSize<T>
[src]
impl<T: Cast> AllBitPatternsValid for MaybeFixedSize<T>
[src]
impl<T: Cast> Cast for MaybeFixedSize<T>
[src]
fn default_ref() -> &'static Self
[src]
fn try_from_aligned_slice(
slice: &AlignedSlice<Self::AlignOf>
) -> Result<&Self, WrongSize>
[src]
slice: &AlignedSlice<Self::AlignOf>
) -> Result<&Self, WrongSize>
fn try_from_aligned_slice_mut(
slice: &mut AlignedSlice<Self::AlignOf>
) -> Result<&mut Self, WrongSize>
[src]
slice: &mut AlignedSlice<Self::AlignOf>
) -> Result<&mut Self, WrongSize>
fn from_aligned_slice(slice: &AlignedSlice<Self::AlignOf>) -> &Self
[src]
impl<T: Cast + Debug> Debug for MaybeFixedSize<T>
[src]
impl<T: Cast + Eq> Eq for MaybeFixedSize<T>
[src]
impl<'a, T: Cast> From<&'a MaybeFixedSize<T>> for Option<&'a T>
[src]
fn from(m: &'a MaybeFixedSize<T>) -> Self
[src]
impl<T: Cast + Hash> Hash for MaybeFixedSize<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T: Cast> IntoIterator for &'a MaybeFixedSize<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = IntoIter<&'a T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'_, '_, T: Cast + PartialEq> PartialEq<&'_ MaybeFixedSize<T>> for Option<&'_ T>
[src]
fn eq(&self, other: &&MaybeFixedSize<T>) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: Cast + PartialEq> PartialEq<MaybeFixedSize<T>> for MaybeFixedSize<T>
[src]
impl<'_, '_, T: Cast + PartialEq> PartialEq<Option<&'_ T>> for &'_ MaybeFixedSize<T>
[src]
impl<T: Cast + PartialOrd> PartialOrd<MaybeFixedSize<T>> for MaybeFixedSize<T>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: Cast> RefCast for MaybeFixedSize<T>
[src]
type From = AlignedSlice<T::AlignOf>
fn ref_cast(_from: &Self::From) -> &Self
[src]
fn ref_cast_mut(_from: &mut Self::From) -> &mut Self
[src]
impl<'a, GvT: Cast + SerializeTo<GvT>> SerializeTo<MaybeFixedSize<GvT>> for &'a MaybeFixedSize<GvT> where
&'a GvT: SerializeTo<GvT>,
[src]
&'a GvT: SerializeTo<GvT>,
impl<'_, GvT: Cast, T: SerializeTo<GvT> + Copy> SerializeTo<MaybeFixedSize<GvT>> for &'_ Option<T> where
T: SerializeTo<GvT>,
[src]
T: SerializeTo<GvT>,
impl<T: Cast> ToOwned for MaybeFixedSize<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for MaybeFixedSize<T> where
T: RefUnwindSafe,
<T as AlignOf>::AlignOf: RefUnwindSafe,
T: RefUnwindSafe,
<T as AlignOf>::AlignOf: RefUnwindSafe,
impl<T> Send for MaybeFixedSize<T> where
T: Send,
<T as AlignOf>::AlignOf: Send,
T: Send,
<T as AlignOf>::AlignOf: Send,
impl<T> Sync for MaybeFixedSize<T> where
T: Sync,
<T as AlignOf>::AlignOf: Sync,
T: Sync,
<T as AlignOf>::AlignOf: Sync,
impl<T> Unpin for MaybeFixedSize<T> where
T: Unpin,
<T as AlignOf>::AlignOf: Unpin,
T: Unpin,
<T as AlignOf>::AlignOf: Unpin,
impl<T> UnwindSafe for MaybeFixedSize<T> where
T: UnwindSafe,
<T as AlignOf>::AlignOf: UnwindSafe,
T: UnwindSafe,
<T as AlignOf>::AlignOf: 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,
fn borrow_mut(&mut self) -> &mut 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.
fn to_owned(&self) -> T
[src]
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.
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>,