Trait rattish::container::Coercible[][src]

pub unsafe trait Coercible {
    type Coerced: ?Sized;
    type Inner: ?Sized + Coercible;
    type Innermost: ?Sized;
}
Expand description

A type that inherits Pointee::Metadata from a contained type, pointers to which are therefore coercible if that contained type is coercible.

Safety

The safety of unsafe code in rattish depends upon this trait being correctly implemented.

Associated Types

The type that Self will become if the contained type is coerced to U.

Note that this is a generic associated type, parameters of which are not presently rendered by Rustdoc. Its full declaration is:

type Coerced<U: 'static + ?Sized>: ?Sized

For example: &mut T becomes &mut T::Coerced<U>, Box<T> becomes Box<T::Coerced<U>>, etc. A dyn Trait will generally just become U.

The directly contained type, similar to Deref::Target but without any dereferencing (so is safe for raw pointers too). For example: T is the inner type of an &mut T, a Box<T>, etc. The inner type of a leaf such as dyn Trait is Self.

The ultimate type whose Pointee::Metadata is that of Self. For example, if Self::Metadata is DynMetadata<T>, then Innermost will be T.

Unless Self is a leaf, such as a dyn Trait (in which case this is just Self), this should just delegate to the contained type’s Innermost.

Implementations on Foreign Types

Implementors