Struct Resp

Source
pub struct Resp<M: Message> { /* private fields */ }
Expand description

The Resp represents a full response from a RPC that may have an attached stream.

Implementations§

Source§

impl<M: Message> Resp<M>

Source

pub fn new(v: M::Response) -> Self

Creates a new response from a base response message

Source

pub fn with_stream_from_buffer(self, b: Bytes) -> Self

Attach a stream to message in response, where the stream is streamed from a fixed Bytes buffer

Source

pub fn with_stream(self, b: ByteStream) -> Self

Attach a stream to message in response, where the stream is an instance of ByteStream.

Source

pub fn with_order_tag(self, order_tag: OrderTag) -> Self

Add an order tag to this response to indicate in which order it should be sent.

Source

pub fn msg(&self) -> &M::Response

Get a reference to the response message contained in this request

Source

pub fn into_msg(self) -> M::Response

Transforms the Resp<M> into the response message it contains, dropping everything else (including attached data stream)

Source

pub fn into_parts(self) -> (M::Response, Option<ByteStream>)

Transforms the Resp<M> into, on the one side, the response message it contains, and on the other side, the associated data stream if it exists

Trait Implementations§

Source§

impl<M> Debug for Resp<M>
where M: Message, <M as Message>::Response: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<M> !Freeze for Resp<M>

§

impl<M> !RefUnwindSafe for Resp<M>

§

impl<M> Send for Resp<M>

§

impl<M> Sync for Resp<M>

§

impl<M> Unpin for Resp<M>
where <M as Message>::Response: Unpin, M: Unpin,

§

impl<M> !UnwindSafe for Resp<M>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V