Skip to main content

SharedVecPart

Struct SharedVecPart 

Source
pub struct SharedVecPart<T> { /* private fields */ }
Expand description

A slice-like view into a segment of a SharedVecMut allocation.

It can be read as a slice or mutated in place while the underlying allocation is still owned by the original SharedVecMut.

Dropping a SharedVecPart leaks the underlying allocation. When the panic-on-drop feature is enabled, dropping it will panic:

let mut values = manual_share::SharedVecMut::from_vec(vec![1, 2, 3, 4]);
let mut part = values.split_off(2).unwrap();

// forget SharedVecMut to make sure the panic is not caused by dropping it first.
std::mem::forget(values);

// panic here due to dropping ShareVecPart

Implementations§

Source§

impl<T> SharedVecPart<T>

Source

pub fn as_slice(&self) -> &[T]

View the part as an immutable slice.

Source

pub fn as_slice_mut(&mut self) -> &mut [T]

View the part as a mutable slice.

Trait Implementations§

Source§

impl<T: Debug> Debug for SharedVecPart<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for SharedVecPart<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send> Send for SharedVecPart<T>

Source§

impl<T: Sync> Sync for SharedVecPart<T>

Auto Trait Implementations§

§

impl<T> Freeze for SharedVecPart<T>

§

impl<T> RefUnwindSafe for SharedVecPart<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for SharedVecPart<T>

§

impl<T> UnsafeUnpin for SharedVecPart<T>

§

impl<T> UnwindSafe for SharedVecPart<T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.