Struct rd_interface::Context[][src]

pub struct Context { /* fields omitted */ }

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 fn insert<I: Serialize>(
    &mut self,
    key: String,
    value: I
) -> Result<(), Error>
[src]

Inserts a key-value pair into the context.

pub fn remove<T: DeserializeOwned>(&mut self, key: &str) -> Result<T, Error>[src]

Removes a key from the context, returning the value at the key if the key was previously in the context.

pub fn get<T: DeserializeOwned>(&self, key: &str) -> Result<T, Error>[src]

Returns a value corresponding to the key.

pub fn insert_value(&mut self, key: String, value: Value)[src]

Inserts a key-value pair into the context.

pub 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 fn get_value(&self, key: &str) -> Option<&Value>[src]

Returns a value corresponding to the key.

pub fn insert_common<T: CommonField>(
    &mut self,
    value: T::Type
) -> Result<(), Error>
[src]

Inserts a key-value pair into the context.

pub fn get_common<T: CommonField>(&self) -> Result<T::Type, Error>[src]

Returns a value corresponding to the key.

Trait Implementations

impl Debug for Context[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.