pub struct TypeGenerator<'a> { /* private fields */ }
Expand description

Generate a Rust module containing all types defined in the supplied PortableRegistry.

Implementations§

Construct a new TypeGenerator.

Generate a module containing all types defined in the supplied type registry.

Panics

If no type with the given id found in the type registry.

Get the type path for a field of a struct or an enum variant, providing any generic type parameters from the containing type. This is for identifying where a generic type parameter is used in a field type e.g.

struct S<T> {
    a: T, // `T` is the "parent" type param from the containing type.
    b: Vec<Option<T>>, // nested use of generic type param `T`.
}

This allows generating the correct generic field type paths.

Panics

If no type with the given id found in the type registry.

Get the type path for the given type identifier.

Panics

If no type with the given id found in the type registry.

Returns the derives to be applied to all generated types.

Returns the derives to be applied to a generated type.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more