pub struct Casts { /* private fields */ }
Expand description

Stores known ways to cast from concrete types to trait objects.

Implementations

Adds a cast from T to U.

Safety

The provided function must not do anything except trivially return the pointer that it is given, potentially with a vtable attached.

Looks up an index that can be used to quickly access a cast from the source type to the destination type, via Casts::cast.

Casts the input type-erased pointer into the destination type. The resulting pointer is only safe to dereference if the underlying type behind the src pointer is the right source type for the given cast index.

Looks up the destination type for the given cast.

Looks up the source type for the given cast.

Iterates over known casts into the given target type. Items in the returned iterator are (source type, cast key).

Iterates over known casts out of the given source type. Items in the returned iterator are (target type, cast key).

Trait Implementations

Returns the “default value” for a type. 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.