Skip to main content

LateStruct

Trait LateStruct 

Source
pub unsafe trait LateStruct:
    Sized
    + 'static
    + LateStructSealed {
    type EraseTo: ?Sized + 'static;

    // Required method
    fn raw_descriptor() -> &'static RawLateStructDescriptor;

    // Provided method
    fn descriptor() -> &'static LateStructDescriptor<Self> { ... }
}
Expand description

A trait for a marker type representing a late-initialized structure.

This trait cannot be implemented manually. Instead, it should be implemented using the late_struct! macro. Most documentation for this trait can be found there.

§Safety

This trait can only be safely implemented through the late_struct! macro.

Required Associated Types§

Source

type EraseTo: ?Sized + 'static

The type all fields are expected to coerce into. This is usually a trait object.

In the following invocation of late_struct!

use late_struct::late_struct;
late_struct!(MyType => dyn Any + Send + Sync);

…the type <MyType as LateStruct>::EraseTo would be dyn Any + Send + Sync.

If no erase-to type is specified in an invocation of late_struct!, a default dyn 'static + fmt::Debug type will be used.

Required Methods§

Source

fn raw_descriptor() -> &'static RawLateStructDescriptor

Fetches the untyped descriptor associated with this structure.

See LateStruct::descriptor for a typed version of this method.

Provided Methods§

Source

fn descriptor() -> &'static LateStructDescriptor<Self>

Fetches the strongly-typed descriptor associated with this structure.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§