Struct protobuf::RepeatedField [−][src]
pub struct RepeatedField<T> { /* fields omitted */ }
Expand description
Wrapper around vector to avoid deallocations on clear.
Implementations
Create new empty container.
Create a contained with data from given vec.
View data as mutable slice.
Get mutable subslice of this container.
Get slice from given index.
Get mutable slice from given index.
Get mutable slice to given index.
View this container as two slices split at given index.
View this container as two mutable slices split at given index.
Retains only the elements specified by the predicate.
In other words, remove all elements e
such that f(&e)
returns false
.
This method operates in place, visiting each element exactly once in the
original order, and preserves the order of the retained elements.
Examples
let mut vec = RepeatedField::from(vec![1, 2, 3, 4]);
vec.retain(|&x| x % 2 == 0);
assert_eq!(vec, RepeatedField::from(vec![2, 4]));
Sort elements with given comparator.
Get data a mutable raw pointer.
Push default value.
This operation could be faster than rf.push(Default::default())
,
because it may reuse previously allocated and cleared element.
Copy slice data to RepeatedField
Trait Implementations
Returns the “default value” for a type. Read more
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Self, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Performs the conversion.
Performs the conversion.
Creates a value from an iterator. Read more
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for RepeatedField<T> where
T: RefUnwindSafe,
impl<T> Send for RepeatedField<T> where
T: Send,
impl<T> Sync for RepeatedField<T> where
T: Sync,
impl<T> Unpin for RepeatedField<T> where
T: Unpin,
impl<T> UnwindSafe for RepeatedField<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more