Request

Struct Request 

Source
pub struct Request<M, R>
where R: 'static,
{ /* private fields */ }

Implementations§

Source§

impl<M, R> Request<M, R>

Source

pub async fn process<F: FnOnce(M) -> R>(self, f: F)

Process the message using a closure.

The return value of the closure is used as the response.

Source

pub async fn reply(self, value: R)

Reply to the request using the provided value.

Source

pub fn get(&self) -> &M

Get a reference to the underlying message

Source

pub fn get_mut(&mut self) -> &mut M

Get a mutable reference to the underlying message

Trait Implementations§

Source§

impl<M, R> AsMut<M> for Request<M, R>

Source§

fn as_mut(&mut self) -> &mut M

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, R> AsRef<M> for Request<M, R>

Source§

fn as_ref(&self) -> &M

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, R> Send for Request<M, R>

Safety: Only the Address or DynamicAddress build requests, meaning that they will use the approriate mutex even if it uses DynamicSender internally For DynamicAddress a NoopRawMutex since it’s already not send For Address, the matching mutex is used

Auto Trait Implementations§

§

impl<M, R> Freeze for Request<M, R>
where M: Freeze,

§

impl<M, R> !RefUnwindSafe for Request<M, R>

§

impl<M, R> !Sync for Request<M, R>

§

impl<M, R> Unpin for Request<M, R>
where M: Unpin,

§

impl<M, R> !UnwindSafe for Request<M, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.