Skip to main content

MutableArray

Struct MutableArray 

Source
pub struct MutableArray<'a, T> { /* private fields */ }
Expand description

An owned mutable array with dirty tracking for generated messages.

Implementations§

Source§

impl<'a, T> MutableArray<'a, T>

Source

pub fn new() -> Self

Creates an empty, clean mutable array.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Removes all values and marks the array dirty.

Source

pub fn reserve(&mut self, additional: usize)

Source

pub fn push(&mut self, value: T)

Appends a value and marks the array dirty.

Source

pub fn as_slice(&self) -> &[T]

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Source

pub fn iter(&self) -> impl Iterator<Item = &T>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>

Source§

impl<'a, T: MutableArrayElement<'a>> MutableArray<'a, T>

Source

pub fn from_words(words: &'a [u32]) -> Option<Self>

Decodes all elements from an encoded array.

Source

pub fn encode_to_unit(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Encodes the array into buffer and returns its field representation.

Trait Implementations§

Source§

impl<'a, T: Clone> Clone for MutableArray<'a, T>

Source§

fn clone(&self) -> MutableArray<'a, T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Debug> Debug for MutableArray<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Default for MutableArray<'a, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, T> Extend<T> for MutableArray<'a, T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, T> From<Vec<T>> for MutableArray<'a, T>

Source§

fn from(values: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> FromIterator<T> for MutableArray<'a, T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, T> Index<usize> for MutableArray<'a, T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T> IndexMut<usize> for MutableArray<'a, T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'b, 'a, T> IntoIterator for &'b MutableArray<'a, T>

Source§

type Item = &'b T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'b, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'b, 'a, T> IntoIterator for &'b mut MutableArray<'a, T>

Source§

type Item = &'b mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'b, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T: MutableArrayElement<'a>> MutableArrayElement<'a> for MutableArray<'a, T>

Source§

fn decode_array(words: &'a [u32]) -> Option<Vec<Self>>

Source§

fn detect_array_field(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn encode_array( values: &[Self], buffer: &mut Buffer, ) -> Result<Unit, MutableError>

Source§

fn detect_array_words(words: &'a [u32]) -> Option<&'a [u32]>

Source§

impl<'a, T: MutableArrayElement<'a>> MutableField<'a> for MutableArray<'a, T>

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn is_dirty(&self) -> bool

Source§

fn has_nested_dirty(&self) -> bool

Source§

fn folds_when_present() -> bool
where Self: Sized,

Auto Trait Implementations§

§

impl<'a, T> Freeze for MutableArray<'a, T>

§

impl<'a, T> RefUnwindSafe for MutableArray<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for MutableArray<'a, T>
where T: Send,

§

impl<'a, T> Sync for MutableArray<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for MutableArray<'a, T>
where T: Unpin,

§

impl<'a, T> UnsafeUnpin for MutableArray<'a, T>

§

impl<'a, T> UnwindSafe for MutableArray<'a, T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.