Struct rd_interface::context::Context [−][src]
A context stores a source endpoint, a process info and other any values during connecting.
Implementations
impl Context
[src]
pub fn new() -> Context
[src]
new a empty context
pub async fn insert_value_lazy(
&mut self,
key: String,
f: impl Fn() -> BoxFuture<'static, Value> + Send + Sync + 'static
) -> Result<()>
[src]
&mut self,
key: String,
f: impl Fn() -> BoxFuture<'static, Value> + Send + Sync + 'static
) -> Result<()>
Inserts a key-value pair into the context. Value can be compute later.
pub async fn insert<I: Serialize>(
&mut self,
key: String,
value: I
) -> Result<()>
[src]
&mut self,
key: String,
value: I
) -> Result<()>
Inserts a key-value pair into the context.
pub async fn remove<T: DeserializeOwned>(&mut self, key: &str) -> Result<()>
[src]
Removes a key from the context
pub async fn get<T: DeserializeOwned>(&self, key: &str) -> Result<T>
[src]
Returns a value corresponding to the key.
pub async fn insert_value(&mut self, key: String, value: Value)
[src]
Inserts a key-value pair into the context.
pub async fn remove_value(&mut self, key: &str) -> Option<Value>
[src]
Removes a key from the context, returning the value at the key if the key was previously in the context.
pub async fn get_value(&self, key: &str) -> Option<Value>
[src]
Returns a value corresponding to the key.
pub async fn insert_common<T: CommonField>(
&mut self,
value: T::Type
) -> Result<()>
[src]
&mut self,
value: T::Type
) -> Result<()>
Inserts a key-value pair into the context.
pub async fn get_common<T: CommonField>(&self) -> Result<T::Type>
[src]
Returns a value corresponding to the key.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,