Struct runestick::Vec[][src]

#[repr(transparent)]
pub struct Vec { /* fields omitted */ }
Expand description

Struct representing a dynamic vector.

Examples

let mut vec = runestick::Vec::new();
assert!(vec.is_empty());

vec.push_value(42)?;
vec.push_value(true)?;
assert_eq!(2, vec.len());

assert_eq!(Some(42), vec.get_value(0)?);
assert_eq!(Some(true), vec.get_value(1)?);
assert_eq!(None::<bool>, vec.get_value(2)?);

Implementations

Construct a new empty dynamic vector.

Sort the vector with the given comparison function.

Construct a new dynamic vector guaranteed to have at least the given capacity.

Convert into inner std vector.

Returns true if the dynamic vector contains no elements.

Returns the number of elements in the dynamic vector, also referred to as its ‘length’.

Set by index

Appends an element to the back of a dynamic vector.

Appends an element to the back of a dynamic vector, converting it as necessary through the ToValue trait.

Get the value at the given index.

Get the given value at the given index.

Get the mutable value at the given index.

Removes the last element from a dynamic vector and returns it, or None if it is empty.

Removes the element at the specified index from a dynamic vector.

Clears the vector, removing all values.

Note that this method has no effect on the allocated capacity of the vector.

Inserts an element at position index within the vector, shifting all elements after it to the right.

Extend this vector with something that implements the into_iter protocol.

Convert into a runestick iterator.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Try to convert to the given type, from the given value.

Hook to install more things into the module.

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

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

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

The generic name of the named thing.

The exact type name

Convert into a value.

Convert into a type hash.

Access diagnostical information on the value type.

The output type from the unsafe coercion.

The raw guard returned. Read more

Convert the given reference using unsafe assumptions to a value. Read more

Coerce the output of an unsafe from value into the final output type. Read more

The output type from the unsafe coercion.

The raw guard returned. Read more

Convert the given reference using unsafe assumptions to a value. Read more

Coerce the output of an unsafe from value into the final output type. Read more

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.