pub trait Shapely: Sized {
// Required method
fn shape() -> Shape;
// Provided methods
fn shape_desc() -> ShapeDesc { ... }
fn partial() -> Partial<'static> { ... }
fn partial_from_uninit(dest: &mut MaybeUninit<Self>) -> Partial<'_> { ... }
}
Expand description
Allows querying the Shape of a type, which in turn lets us inspect any fields, build a value of this type progressively, etc.
Required Methods§
Provided Methods§
Sourcefn shape_desc() -> ShapeDesc
fn shape_desc() -> ShapeDesc
Returns a shape def (a function that can describe this shape)
Sourcefn partial() -> Partial<'static>
fn partial() -> Partial<'static>
Allocates this shape on the heap and return a partial that allows gradually initializing its fields.
Sourcefn partial_from_uninit(dest: &mut MaybeUninit<Self>) -> Partial<'_>
fn partial_from_uninit(dest: &mut MaybeUninit<Self>) -> Partial<'_>
Initializes a Partial
from a borrowed MaybeUninit<Self>
.
Before calling assume_init, make sure to call Partial.build_in_place().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.