pub struct SliceCopyMut<'a, V = ()> where
    V: ?Sized
{ /* private fields */ }

Implementations

Construct a SliceCopyMut 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 SliceCopy 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.

Swap the values at the two given indices.

Upcast the SliceCopyMut into a more general base SliceCopy.

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

Copy data from a given slice into the current slice.

Panics

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

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.

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.

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

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

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

Copies contents of self into the given Vec.

Convert this SliceCopyMut 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 = SliceCopyMut::<()>::from_slice(vec.as_mut_slice());
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 = SliceCopyMut::<()>::from_slice(vec.as_mut_slice());
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 immutable value reference to the element at index i.

Get a mutable value reference to the element at index i.

Get an immutable subslice representing the given range of indices.

Get a mutable subslice representing the given range of indices.

Conver this slice into a mutable subslice representing the given range of indices.

Trait Implementations

Convert a &mut [T] to a SliceCopyMut.

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.

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.