Skip to main content

Sealed

Trait Sealed 

Source
pub trait Sealed<T> {
    type Output;

    // Required methods
    fn parts_mut(&mut self) -> (*mut T, usize);
    unsafe fn assume_init(self, len: usize) -> Self::Output;
}

Required Associated Types§

Source

type Output

The result of the process operation.

Required Methods§

Source

fn parts_mut(&mut self) -> (*mut T, usize)

Return a pointer and length for this buffer.

The length is the number of elements of type T, not a number of bytes.

It’s tempting to have this return &mut [MaybeUninit<T>] instead, however that would require this function to be unsafe, because callers could use the &mut [MaybeUninit<T>] slice to set elements to MaybeUninit::<T>::uninit(), which would be a problem if Self is &mut [T] or similar.

Source

unsafe fn assume_init(self, len: usize) -> Self::Output

Convert a finished buffer pointer into its result.

§Safety

At least len elements of the buffer must now be initialized.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T, const N: usize> Sealed<T> for &'a mut [MaybeUninit<T>; N]

Source§

type Output = (&'a mut [T], &'a mut [MaybeUninit<T>])

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Source§

impl<'a, T> Sealed<T> for &'a mut Vec<MaybeUninit<T>>

Available on crate feature alloc only.
Source§

type Output = (&'a mut [T], &'a mut [MaybeUninit<T>])

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Source§

impl<'a, T> Sealed<T> for &'a mut [MaybeUninit<T>]

Source§

type Output = (&'a mut [T], &'a mut [MaybeUninit<T>])

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Source§

impl<T, const N: usize> Sealed<T> for &mut [T; N]

Source§

type Output = usize

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Source§

impl<T> Sealed<T> for &mut Vec<T>

Available on crate feature alloc only.
Source§

type Output = usize

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Source§

impl<T> Sealed<T> for &mut [T]

Source§

type Output = usize

Source§

fn parts_mut(&mut self) -> (*mut T, usize)

Source§

unsafe fn assume_init(self, len: usize) -> Self::Output

Implementors§

Source§

impl<'a, T> Sealed<T> for SpareCapacity<'a, T>

Available on crate feature alloc only.