pub unsafe trait Dst {
// Required methods
fn len(&self) -> usize;
fn layout(len: usize) -> Result<Layout, LayoutError>;
fn retype(ptr: NonNull<u8>, len: usize) -> NonNull<Self>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Required Methods§
Sourcefn len(&self) -> usize
fn len(&self) -> usize
The length of the DST.
Note that this is NOT the size of the type, for that you should use
Layout::for_value or Dst::layout.
Sourcefn layout(len: usize) -> Result<Layout, LayoutError>
fn layout(len: usize) -> Result<Layout, LayoutError>
Returns the layout of the DST, assuming it has the given length.
§Errors
Returns a LayoutError if calculation of the layout fails.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".