pub struct TypeSpec<F: Form = MetaForm> { /* private fields */ }
Expand description

A type specification.

This contains the actual type as well as an optional compile-time known displayed representation of the type. This is useful for cases where the type is used through a type alias in order to provide information about the alias name.

Examples

Consider the following Rust function:

fn is_sorted(input: &[i32], pred: Predicate) -> bool;

In this above example input would have no displayable name, preds display name is Predicate and the display name of the return type is simply bool. Note that Predicate could simply be a type alias to fn(i32, i32) -> Ordering.

Implementations

Creates a new type specification with a display name.

The name is any valid Rust identifier or path.

Examples

Valid display names are foo, foo::bar, foo::bar::Baz, etc.

Panics

Panics if the given display name is invalid.

Creates a new type specification with a display name represented by the given path segments.

The display name segments all must be valid Rust identifiers.

Examples

Valid display names are foo, foo::bar, foo::bar::Baz, etc.

Panics

Panics if the given display name is invalid.

Creates a new type specification without a display name.

Returns the actual type.

Returns the compile-time known displayed representation of the type.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

The portable version of Self.

Convert self to the portable form by using the registry for caching.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. 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.

Calls U::from(self).

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

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.