Skip to main content

RepeatedMut

Struct RepeatedMut 

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

Mutates the elements in a repeated field of T.

Implementations§

Source§

impl<'msg, T> RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source

pub fn len(&self) -> usize

Gets the length of the repeated field.

Source

pub fn is_empty(&self) -> bool

Returns true if the repeated field has no values.

Source

pub fn get(&self, index: usize) -> Option<View<'_, T>>

Gets the value at index.

Returns None if index >= len.

Source

pub fn get_mut<'r>(&'r mut self, index: usize) -> Option<Mut<'msg, T>>
where T: Message, 'r: 'msg,

Gets the value at index.

Returns None if index >= len.

Source

pub unsafe fn get_mut_unchecked<'r>(&'r mut self, index: usize) -> Mut<'msg, T>
where T: Message, 'r: 'msg,

Gets the value at index without bounds-checking.

§Safety

Undefined behavior if index >= len.

Source

pub unsafe fn get_unchecked(&self, index: usize) -> View<'_, T>

Gets the value at index without bounds-checking.

§Safety

Undefined behavior if index >= len.

Source

pub fn push(&mut self, val: impl IntoProxied<T>)

Appends val to the end of the repeated field.

Source

pub fn set(&mut self, index: usize, val: impl IntoProxied<T>)

Sets the value at index to the value val.

§Panics

Panics if index >= len.

Source

pub unsafe fn set_unchecked(&mut self, index: usize, val: impl IntoProxied<T>)

Sets the value at index to the value val.

§Safety

Undefined behavior if index >= len.

Source

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

Iterates over the values in the repeated field.

Source

pub fn copy_from(&mut self, src: RepeatedView<'_, T>)

Copies from the src repeated field into this one.

Source

pub fn clear(&mut self)

Clears the repeated field.

Trait Implementations§

Source§

impl<'msg, T> AsMut for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

type MutProxied = Repeated<T>

Source§

fn as_mut(&mut self) -> RepeatedMut<'_, T>

Converts a borrow into a Mut with the lifetime of that borrow.
Source§

impl<'msg, T> AsView for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

type Proxied = Repeated<T>

Source§

fn as_view(&self) -> RepeatedView<'_, T>

Converts a borrow into a View with the lifetime of that borrow. Read more
Source§

impl<'msg, T> Debug for RepeatedMut<'msg, T>

Source§

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

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

impl<'msg, 'view, T, ViewT> Extend<ViewT> for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'view, ViewT: IntoProxied<T>,

Source§

fn extend<I: IntoIterator<Item = ViewT>>(&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<'borrow, T> IntoIterator for &'borrow RepeatedMut<'_, T>
where T: ProxiedInRepeated + 'borrow,

Source§

type Item = <T as Proxied>::View<'borrow>

The type of the elements being iterated over.
Source§

type IntoIter = RepeatedIter<'borrow, 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<'msg, T> IntoMut<'msg> for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

fn into_mut<'shorter>(self) -> RepeatedMut<'shorter, T>
where 'msg: 'shorter,

Converts into a Mut with a potentially shorter lifetime. Read more
Source§

impl<'msg, T> IntoView<'msg> for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

fn into_view<'shorter>(self) -> RepeatedView<'shorter, T>
where 'msg: 'shorter,

Converts into a View with a potentially shorter lifetime. Read more
Source§

impl<'msg, T> MutProxy<'msg> for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

fn get(&self) -> View<'_, Self::Proxied>

Gets an immutable view of this field. This is shorthand for as_view. Read more
Source§

impl<'msg, T> IntoProxied<Repeated<T>> for RepeatedMut<'msg, T>
where T: 'msg + ProxiedInRepeated,

Source§

impl<'msg, T> Proxy<'msg> for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

impl<'msg, T> SealedInternal for RepeatedMut<'msg, T>
where T: ProxiedInRepeated + 'msg,

Source§

impl<'msg, T> Sync for RepeatedMut<'msg, T>

Auto Trait Implementations§

§

impl<'msg, T> Freeze for RepeatedMut<'msg, T>

§

impl<'msg, T> !RefUnwindSafe for RepeatedMut<'msg, T>

§

impl<'msg, T> !Send for RepeatedMut<'msg, T>

§

impl<'msg, T> Unpin for RepeatedMut<'msg, T>

§

impl<'msg, T> !UnwindSafe for RepeatedMut<'msg, T>

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> 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, 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.