Struct sixtyfps_corelib::SharedVector [−][src]
#[repr(C)]pub struct SharedVector<T> { /* fields omitted */ }
Expand description
SharedVector holds a reference-counted read-only copy of [T]
.
Implementations
Create a new empty array with a pre-allocated capacity in number of items
Create a SharedVector from a slice
👎 Deprecated: Use make_mut_slice() instead
Use make_mut_slice() instead
Return a mutable slice to the array. If the array was shared, this will make a copy of the array.
Return a mutable slice to the array. If the array was shared, this will make a copy of the array.
Add an element to the array. If the array was shared, this will make a copy of the array.
Resize the array to the given size. If the array was smaller new elements will be initialized with the value. If the array was bigger, extra elements will be discarded
use sixtyfps_corelib::SharedVector; let mut shared_vector = SharedVector::<u32>::from_slice(&[1, 2, 3]); shared_vector.resize(5, 8); assert_eq!(shared_vector.as_slice(), &[1, 2, 3, 8, 8]); shared_vector.resize(2, 0); assert_eq!(shared_vector.as_slice(), &[1, 2]);
Trait Implementations
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
Creates a value from an iterator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for SharedVector<T> where
T: RefUnwindSafe,
impl<T> !Send for SharedVector<T>
impl<T> !Sync for SharedVector<T>
impl<T> Unpin for SharedVector<T>
impl<T> UnwindSafe for SharedVector<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more