Trait typemap_core::Contains[][src]

pub trait Contains<T>: TypeMapGet { }

The Contains trait marks a map as containing at least one instance of a given type that can be accessed

use typemap_core::{typemap, Contains};
fn requires_u32<Opts: Contains<u32>>(opts: &Opts) {
    println!("{}", opts.get::<u32>());
}

requires_u32(&typemap!(u32 = 42u32));

On nightly, this trait functions as intended with the help of an unstable feature. Unfortunately, it cannot be implemented as intended on stable at the moment, so it is given a blanket implementation to ensure that bounds that work on nightly do not cause errors on stable.

Implementors

impl<A: 'static, B: 'static, R: Contains<B>> Contains<B> for Ty<A, R>[src]

impl<A: 'static, B: 'static, R: TypeMapGet> Contains<A> for &Ty<B, R> where
    Ty<B, R>: Contains<A>, 
[src]

impl<A: 'static, B: 'static, R: TypeMapGet> Contains<A> for &mut Ty<B, R> where
    Ty<B, R>: Contains<A>, 
[src]

impl<A: 'static, R: TypeMapGet> Contains<A> for Ty<A, R>[src]

Loading content...