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§
Required Methods§
Sourcefn parts_mut(&mut self) -> (*mut T, usize)
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.
Sourceunsafe fn assume_init(self, len: usize) -> Self::Output
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> Sealed<T> for &'a mut Vec<MaybeUninit<T>>
Available on crate feature alloc only.
impl<'a, T> Sealed<T> for &'a mut Vec<MaybeUninit<T>>
Available on crate feature
alloc only.