[][src]Struct gvariant::MaybeNonFixedSize

#[repr(transparent)]pub struct MaybeNonFixedSize<T: Cast + ?Sized> { /* fields omitted */ }

Type with same representation as GVariant "mX" type where X is any non-fixed size type

This is the type returned by:

gv!("ms").cast(data);
gv!("mmi").cast(data);
gv!("m(ias)").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. MaybeFixedSize is used when the contained size is fixed, but it implements the same interface as this type.

Implementations

impl<T: Cast + ?Sized> MaybeNonFixedSize<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 + ?Sized> AlignOf for MaybeNonFixedSize<T>[src]

type AlignOf = T::AlignOf

impl<T: Cast + ?Sized> AllBitPatternsValid for MaybeNonFixedSize<T>[src]

impl<T: Cast + ?Sized> Cast for MaybeNonFixedSize<T>[src]

impl<T: Cast + Debug + ?Sized> Debug for MaybeNonFixedSize<T>[src]

impl<T: Cast + Eq + ?Sized> Eq for MaybeNonFixedSize<T>[src]

impl<'a, T: Cast + ?Sized> From<&'a MaybeNonFixedSize<T>> for Option<&'a T>[src]

impl<'a, T: Cast + ?Sized> IntoIterator for &'a MaybeNonFixedSize<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?

impl<T: Cast + PartialEq + ?Sized> PartialEq<MaybeNonFixedSize<T>> for MaybeNonFixedSize<T>[src]

impl<T: Cast + PartialEq, '_> PartialEq<MaybeNonFixedSize<T>> for Option<&'_ T>[src]

impl<T: Cast + PartialEq, '_> PartialEq<Option<&'_ T>> for MaybeNonFixedSize<T>[src]

impl<T: Cast + ?Sized> RefCast for MaybeNonFixedSize<T>[src]

type From = AlignedSlice<T::AlignOf>

impl<GvT: Cast + ?Sized, T: IntoIterator> SerializeTo<MaybeNonFixedSize<GvT>> for T where
    T::Item: SerializeTo<GvT>, 
[src]

impl<T: Cast + ?Sized> ToOwned for MaybeNonFixedSize<T>[src]

type Owned = Box<Self>

The resulting type after obtaining ownership.

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for MaybeNonFixedSize<T> where
    T: RefUnwindSafe,
    <T as AlignOf>::AlignOf: RefUnwindSafe

impl<T: ?Sized> Send for MaybeNonFixedSize<T> where
    T: Send,
    <T as AlignOf>::AlignOf: Send

impl<T: ?Sized> Sync for MaybeNonFixedSize<T> where
    T: Sync,
    <T as AlignOf>::AlignOf: Sync

impl<T: ?Sized> Unpin for MaybeNonFixedSize<T> where
    T: Unpin,
    <T as AlignOf>::AlignOf: Unpin

impl<T: ?Sized> UnwindSafe for MaybeNonFixedSize<T> where
    T: UnwindSafe,
    <T as AlignOf>::AlignOf: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<GvT, T> SerializeTo<MaybeNonFixedSize<GvT>> for T where
    GvT: Cast + ?Sized,
    T: IntoIterator,
    <T as IntoIterator>::Item: SerializeTo<GvT>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.