Struct async_injector::Key [−][src]
pub struct Key<T> where
T: Any, { /* fields omitted */ }
Expand description
A key used to discriminate a value in the Injector.
Implementations
Construct a new key without a tag.
Examples
use async_injector::Key;
struct Foo;
assert_eq!(Key::<Foo>::of(), Key::<Foo>::of());
Construct a new key.
Examples
use serde::Serialize;
use async_injector::Key;
use std::error::Error;
struct Foo;
#[derive(Serialize)]
enum Tag {
One,
Two,
}
#[derive(Serialize)]
enum Tag2 {
One,
Two,
}
assert_eq!(Key::<Foo>::tagged(Tag::One)?, Key::<Foo>::tagged(Tag::One)?);
assert_ne!(Key::<Foo>::tagged(Tag::One)?, Key::<Foo>::tagged(Tag::Two)?);
assert_ne!(Key::<Foo>::tagged(Tag::One)?, Key::<Foo>::tagged(Tag2::One)?);
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Key<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Key<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more