pub trait MayContain<T> {
// Required method
fn upcast_into(other: T) -> Box<Self>;
}Expand description
§Declare that T may be held by Box<Self>
This trait is used to constrain which types can be put in
Xso<Self>. It is typically implemented on dyn Trait for all
T: Trait.
To automatically generate suitable implementations of this trait, see
derive_dyn_traits.
Implementation-wise, this trait is very similar to Box<Self>: From<T>.
However, From is also used in many different circumstances and it cannot
be suitably overloaded on Box<_>, so a new trait was introduced for this
particular purpose.
Required Methods§
Sourcefn upcast_into(other: T) -> Box<Self>
fn upcast_into(other: T) -> Box<Self>
Convert a value of T into Box<Self>.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.