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

Number of elements in the array

Return true if the SharedVector is empty

Return a slice to the array

Create a SharedVector from a slice

👎 Deprecated:

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]);

Clears the vector and removes all elements.

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

The resulting type after dereferencing.

Dereferences the value.

Executes the destructor for this type. Read more

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

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.