Struct gvariant::MaybeFixedSize
source · [−]#[repr(transparent)]pub struct MaybeFixedSize<T: Cast> { /* private fields */ }
Expand description
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
Trait Implementations
sourceimpl<T: Cast> Cast for MaybeFixedSize<T>
impl<T: Cast> Cast for MaybeFixedSize<T>
sourcefn default_ref() -> &'static Self
fn default_ref() -> &'static Self
Get a static reference to the default value for this type. Read more
fn try_from_aligned_slice(
slice: &AlignedSlice<Self::AlignOf>
) -> Result<&Self, WrongSize>
fn try_from_aligned_slice_mut(
slice: &mut AlignedSlice<Self::AlignOf>
) -> Result<&mut Self, WrongSize>
sourcefn from_aligned_slice(slice: &AlignedSlice<Self::AlignOf>) -> &Self
fn from_aligned_slice(slice: &AlignedSlice<Self::AlignOf>) -> &Self
Cast slice
to type Self
. Read more
sourceimpl<T: Cast + Debug> Debug for MaybeFixedSize<T>
impl<T: Cast + Debug> Debug for MaybeFixedSize<T>
sourceimpl<'a, T: Cast> From<&'a MaybeFixedSize<T>> for Option<&'a T>
impl<'a, T: Cast> From<&'a MaybeFixedSize<T>> for Option<&'a T>
sourcefn from(m: &'a MaybeFixedSize<T>) -> Self
fn from(m: &'a MaybeFixedSize<T>) -> Self
Converts to this type from the input type.
sourceimpl<T: Cast + Hash> Hash for MaybeFixedSize<T>
impl<T: Cast + Hash> Hash for MaybeFixedSize<T>
sourceimpl<'a, T: Cast> IntoIterator for &'a MaybeFixedSize<T>
impl<'a, T: Cast> IntoIterator for &'a MaybeFixedSize<T>
sourceimpl<T: Cast + PartialEq> PartialEq<MaybeFixedSize<T>> for MaybeFixedSize<T>
impl<T: Cast + PartialEq> PartialEq<MaybeFixedSize<T>> for MaybeFixedSize<T>
sourceimpl<T: Cast + PartialOrd> PartialOrd<MaybeFixedSize<T>> for MaybeFixedSize<T>
impl<T: Cast + PartialOrd> PartialOrd<MaybeFixedSize<T>> for MaybeFixedSize<T>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T: Cast> RefCast for MaybeFixedSize<T>
impl<T: Cast> RefCast for MaybeFixedSize<T>
sourceimpl<'a, GvT: Cast + SerializeTo<GvT>> SerializeTo<MaybeFixedSize<GvT>> for &'a MaybeFixedSize<GvT> where
&'a GvT: SerializeTo<GvT>,
impl<'a, GvT: Cast + SerializeTo<GvT>> SerializeTo<MaybeFixedSize<GvT>> for &'a MaybeFixedSize<GvT> where
&'a GvT: SerializeTo<GvT>,
sourceimpl<GvT: Cast, T: SerializeTo<GvT> + Copy> SerializeTo<MaybeFixedSize<GvT>> for &Option<T> where
T: SerializeTo<GvT>,
impl<GvT: Cast, T: SerializeTo<GvT> + Copy> SerializeTo<MaybeFixedSize<GvT>> for &Option<T> where
T: SerializeTo<GvT>,
sourceimpl<T: Cast> ToOwned for MaybeFixedSize<T>
impl<T: Cast> ToOwned for MaybeFixedSize<T>
type Owned = Owned<MaybeFixedSize<T>>
type Owned = Owned<MaybeFixedSize<T>>
The resulting type after obtaining ownership.
sourcefn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
sourcefn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T: Cast> AllBitPatternsValid for MaybeFixedSize<T>
impl<T: Cast + Eq> Eq for MaybeFixedSize<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for MaybeFixedSize<T> where
T: RefUnwindSafe,
<T as AlignOf>::AlignOf: RefUnwindSafe,
impl<T> Send for MaybeFixedSize<T> where
T: Send,
<T as AlignOf>::AlignOf: Send,
impl<T> !Sized for MaybeFixedSize<T>
impl<T> Sync for MaybeFixedSize<T> where
T: Sync,
<T as AlignOf>::AlignOf: Sync,
impl<T> Unpin for MaybeFixedSize<T> where
T: Unpin,
<T as AlignOf>::AlignOf: Unpin,
impl<T> UnwindSafe for MaybeFixedSize<T> where
T: UnwindSafe,
<T as AlignOf>::AlignOf: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more