pub unsafe trait ToBoxedDyn<T: ?Sized> {
// Required method
fn to_boxed_unsize(value: Self) -> Box<T>;
}Expand description
Trait to construct a Box<dyn Trait> from a type implementing
Unsize<dyn Trait>.
Since Unsize<T> is gated behind the unsize nightly feature,
on stable Rust this trait is only implemented for:
dyn Any + '_dyn Send + '_dyn Sync + '_dyn Send + Sync + '_
Enable the unstable feature to support all possible coercions.
§Safety
Required Methods§
Sourcefn to_boxed_unsize(value: Self) -> Box<T>
fn to_boxed_unsize(value: Self) -> Box<T>
Constructs a Box<T> from Self, coercing into the unsized type.
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.
Implementors§
impl<'a, T: 'a> ToBoxedDyn<dyn Any + 'a> for T
Available on non-crate feature
unstable only.impl<'a, T: Send + 'a> ToBoxedDyn<dyn Send + 'a> for T
Available on non-crate feature
unstable only.impl<'a, T: Send + Sync + 'a> ToBoxedDyn<dyn Send + Sync + 'a> for T
Available on non-crate feature
unstable only.impl<'a, T: Sync + 'a> ToBoxedDyn<dyn Sync + 'a> for T
Available on non-crate feature
unstable only.