pub trait Type {
// Required method
fn definition(types: &mut Types) -> DataType;
}Expand description
Provides runtime type information for a Rust type.
Exporters call this trait to build a DataType graph and collect any
referenced named types into Types. Prefer deriving this trait with
#[derive(Type)]; hand-written implementations must
preserve the same invariants as the derive macro.
§Invariants
Implementations should register every named dependency they reference in the
provided Types collection. Generic placeholders should only be emitted
inside the canonical NamedDataType
definition for the declaring type, not as arbitrary top-level results.
Required Methods§
Sourcefn definition(types: &mut Types) -> DataType
fn definition(types: &mut Types) -> DataType
Returns a DataType that represents Self.
This may mutate types by registering Self and any named datatypes
needed by the returned definition.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Type for SocketAddr
impl Type for SocketAddr
fn definition(types: &mut Types) -> DataType
Source§impl Type for SocketAddrV4
impl Type for SocketAddrV4
fn definition(types: &mut Types) -> DataType
Source§impl Type for SocketAddrV6
impl Type for SocketAddrV6
fn definition(types: &mut Types) -> DataType
Source§impl Type for SystemTime
impl Type for SystemTime
fn definition(types: &mut Types) -> DataType
Source§impl Type for f16
Available on is_nightly only.
impl Type for f16
is_nightly only.fn definition(_: &mut Types) -> DataType
Source§impl Type for f128
Available on is_nightly only.
impl Type for f128
is_nightly only.