pub struct SliceMut<'a, V> where
    V: ?Sized
{ /* private fields */ }

Implementations

Construct a SliceMut from a given typed slice by reusing the provided memory.

Convert this collection into its raw components.

This function exists mainly to enable the into_dyn macro until CoerceUnsized is stabilized.

Construct a SliceMut from raw bytes and type metadata.

Safety

Almost exclusively the only inputs that are safe here are the ones returned by into_raw_parts.

This function should not be used other than in internal APIs. It exists to enable the into_dyn macro until CoerceUsize is stabilized.

Upcast the SliceMut into a more general base SliceMut.

This function converts the underlying virtual function table into a subset of the existing

Check if the current buffer contains elements of the specified type. Returns Some(self) if the type matches and None otherwise.

Construct a clone of the current slice with a reduced lifetime.

This is equivalent to calling subslice with the entire range.

Construct a clone of the current slice with a reduced lifetime.

This is equivalent to calling subslice_mut with the entire range.

Swap the values at the two given indices.

Get the TypeId of data stored within this buffer.

Get the number of elements stored in this buffer.

Check if there are any elements stored in this buffer.

Get the size of the element type in bytes.

Return an iterator to a slice representing typed data. Returs None if the given type T doesn’t match the internal.

Examples
use dync::SliceMutDrop;
let mut vec = vec![1.0_f32, 23.0, 0.01, 42.0, 11.43];
let mut buf: SliceMutDrop = vec.as_mut_slice().into();
for val in buf.iter_as::<f32>().unwrap() {
    *val += 1.0_f32;
}

Convert this SliceMut into a typed slice. Returs None if the given type T doesn’t match the internal.

Get i’th element of the buffer.

Rotates the slice in-place such that the first mid elements of the slice move to the end while the last self.len() - mid elements move to the front. After calling rotate_left, the element previously at index mid will become the first element in the slice.

Example
use dync::*;
let mut vec = vec![1u32,2,3,4,5];
let mut buf: SliceMutDrop = vec.as_mut_slice().into();
buf.rotate_left(3);
assert_eq!(buf.as_slice::<u32>().unwrap(), &[4,5,1,2,3]);

Rotates the slice in-place such that the first self.len() - k elements of the slice move to the end while the last k elements move to the front. After calling rotate_right, the element previously at index k will become the first element in the slice.

Example
use dync::*;
let mut vec = vec![1u32,2,3,4,5];
let mut buf: SliceMutDrop = vec.as_mut_slice().into();
buf.rotate_right(3);
assert_eq!(buf.as_slice::<u32>().unwrap(), &[3,4,5,1,2]);

Return an iterator over untyped value references stored in this slice.

In contrast to iter_as, this function defers downcasting on a per element basis. As a result, this type of iteration is typically less efficient if a typed value is needed for each element.

Get a reference to a value stored in this container at index i.

Get a mutable reference to a value stored in this container at index i.

Get an immutable subslice from the given range of indices.

Get a mutable subslice from the given range of indices.

Convert this slice into a mutable subslice from the given range of indices.

Clone data from a given slice into the current slice.

Panics

This function will panic if the given slice has as different size than current.

Append cloned items from this slice to a given Vec<T>. Return the mutable reference Some(vec) if type matched the internal type and None otherwise.

Clones contents of self into the given Vec.

Trait Implementations

Formats the value using the given formatter. Read more

Convert a &mut [T] to a SliceMut.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.