pub trait Subset<T: IsBound>: IsBound { }Expand description
Check if dynamic trait bound is a subset of another dynamic trait bound.
A dynamic trait bound is a subset of another if it requres less of the bounded type.
For example, T: Send is a subset of T: Send + Sync.
This trait is sealed and cannot be implemented outside of the implementations here.
§Examples
use dungeon_cell::bound::{Subset, bounds};
use dungeon_cell::marker_traits::IsBound;
fn test<A: Subset<B> + IsBound, B: IsBound>() {}
test::<bounds::Empty, bounds::Copy>();
test::<bounds::Send, bounds::Normal>();
test::<bounds::Normal, bounds::Normal>();ⓘ
use dungeon_cell::bound::{Subset, bounds};
use dungeon_cell::marker_traits::IsBound;
fn test<A: Subset<B> + IsBound, B: IsBound>() {}
// only the Empty bound is a subset of the Empty bound
test::<bounds::Copy, bounds::Empty>();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.