[][src]Struct gvariant::NonFixedWidthArray

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

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

This is similar to a slice, but for non-fixed width types, and implements many of the same methods. Items can be retrieved by indexing or iterated over.

For fixed-width types a standard rust slice is used.

Implementations

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

pub fn len(&self) -> usize[src]

Returns the number of elements in the array.

pub fn is_empty(&self) -> bool[src]

Returns true if the array has a length of 0.

pub fn iter(&self) -> NonFixedWidthArrayIterator<'_, T>

Notable traits for NonFixedWidthArrayIterator<'a, Item>

impl<'a, Item: Cast + 'static + ?Sized> Iterator for NonFixedWidthArrayIterator<'a, Item> type Item = &'a Item;
[src]

Returns an iterator over the array.

pub fn first(&self) -> Option<&T>[src]

Returns the first element of the array, or None if it is empty.

pub fn last(&self) -> Option<&T>[src]

Returns the last element of the array, or None if it is empty.

Trait Implementations

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

type AlignOf = T::AlignOf

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

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

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

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

impl<Item: Cast + 'static + ?Sized> Index<usize> for NonFixedWidthArray<Item>[src]

type Output = Item

The returned type after indexing.

impl<'a, Item: Cast + 'static + ?Sized> IntoIterator for &'a NonFixedWidthArray<Item>[src]

type Item = &'a Item

The type of the elements being iterated over.

type IntoIter = NonFixedWidthArrayIterator<'a, Item>

Which kind of iterator are we turning this into?

impl<Item: Cast + ?Sized + PartialEq<T>, T: ?Sized, '_> PartialEq<[&'_ T]> for NonFixedWidthArray<Item>[src]

impl<Item: Cast + ?Sized + PartialEq<T>, T: ?Sized, '_> PartialEq<NonFixedWidthArray<Item>> for [&'_ T][src]

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

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

type From = AlignedSlice<T::AlignOf>

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

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

type Owned = Box<Self>

The resulting type after obtaining ownership.

Auto Trait Implementations

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

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

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

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

impl<T: ?Sized> UnwindSafe for NonFixedWidthArray<T> where
    <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, It> SerializeTo<NonFixedWidthArray<GvT>> for It where
    GvT: Cast + ?Sized,
    It: IntoIterator,
    <It as IntoIterator>::Item: SerializeTo<GvT>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.