[−][src]Struct async_injector::Key
A key used to discriminate a value in the Injector.
Implementations
impl<T> Key<T> where
T: Any,
[src]
T: Any,
pub fn of() -> Self
[src]
Construct a new key without a tag.
Examples
use async_injector::Key; struct Foo; assert_eq!(Key::<Foo>::of(), Key::<Foo>::of());
pub fn tagged<K>(tag: K) -> Result<Self, Error> where
K: Any + Serialize,
[src]
K: Any + Serialize,
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
impl<T> AsRef<Key<T>> for Key<T> where
T: 'static,
[src]
T: 'static,
impl<T: Clone> Clone for Key<T> where
T: Any,
[src]
T: Any,
impl<T> Debug for Key<T> where
T: Any,
[src]
T: Any,
impl<T> Eq for Key<T> where
T: Any,
[src]
T: Any,
impl<T> Hash for Key<T> where
T: Any,
[src]
T: Any,
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Ord for Key<T> where
T: Any,
[src]
T: Any,
pub fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T> PartialEq<Key<T>> for Key<T> where
T: Any,
[src]
T: Any,
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> PartialOrd<Key<T>> for Key<T> where
T: Any,
[src]
T: Any,
Auto Trait Implementations
impl<T> RefUnwindSafe for Key<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Key<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Key<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Key<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Key<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash,
T: Hash,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,