#[non_exhaustive]pub struct Shape {
pub layout: Layout,
pub vtable: &'static ValueVTable,
pub def: Def,
}Expand description
Schema for reflection of a type
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.layout: LayoutSize, alignment
vtable: &'static ValueVTableVTable for common operations. This is indirected because the vtable might
have different functions implemented based on generic type parameters:
HashMap<K, V> is not even constructible if K is not Hash + Eq.
def: DefDetails/contents of the value
Implementations§
Source§impl Shape
impl Shape
Sourcepub const fn is(&'static self, characteristic: Characteristic) -> bool
pub const fn is(&'static self, characteristic: Characteristic) -> bool
Checks if a shape has the given characteristic.
Sourcepub const fn is_partial_eq(&'static self) -> bool
pub const fn is_partial_eq(&'static self) -> bool
Check if this shape implements the PartialEq trait
Sourcepub const fn is_partial_ord(&'static self) -> bool
pub const fn is_partial_ord(&'static self) -> bool
Check if this shape implements the PartialOrd trait
Sourcepub const fn is_default(&'static self) -> bool
pub const fn is_default(&'static self) -> bool
Check if this shape implements the Default trait
Sourcepub fn write_type_name(
&self,
f: &mut Formatter<'_>,
opts: TypeNameOpts,
) -> Result<(), Error>
pub fn write_type_name( &self, f: &mut Formatter<'_>, opts: TypeNameOpts, ) -> Result<(), Error>
Writes the name of this type to the given formatter
Sourcepub const fn builder() -> ShapeBuilder
pub const fn builder() -> ShapeBuilder
Returns a builder for shape
Trait Implementations§
impl Copy for Shape
impl Eq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnwindSafe for Shape
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more