Subset

Trait Subset 

Source
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.

Implementors§

Source§

impl<SendLarger, SyncLarger, CopyLarger, CloneLarger, UnpinLarger, DebugLarger, SendSmaller, SyncSmaller, CopySmaller, CloneSmaller, UnpinSmaller, DebugSmaller> Subset<Bound<SendLarger, SyncLarger, CopyLarger, CloneLarger, UnpinLarger, DebugLarger>> for Bound<SendSmaller, SyncSmaller, CopySmaller, CloneSmaller, UnpinSmaller, DebugSmaller>
where Bound<SendLarger, SyncLarger, CopyLarger, CloneLarger, UnpinLarger, DebugLarger>: IsBound, Bound<SendSmaller, SyncSmaller, CopySmaller, CloneSmaller, UnpinSmaller, DebugSmaller>: IsBound, SendSmaller: SubsetHelper<SendLarger>, SyncSmaller: SubsetHelper<SyncLarger>, CopySmaller: SubsetHelper<CopyLarger>, CloneSmaller: SubsetHelper<CloneLarger>, UnpinSmaller: SubsetHelper<UnpinLarger>, DebugSmaller: SubsetHelper<DebugLarger>,