Skip to main content

Method

Struct Method 

Source
pub struct Method<Request, Reply> { /* private fields */ }
Expand description

Bind an export name, direction limits and Rust DTOs to Wire frames.

An application can infer the lifetimes of borrowing DTOs locally with a type such as Method<Request<'_>, Reply<'_>>.

Implementations§

Source§

impl<Request, Reply> Method<Request, Reply>

Source

pub const fn new( name: &'static str, request_limits: Limits, reply_limits: Limits, ) -> Self

Define the Wire method for the exact exported name.

A const descriptor computes the routing ID at compile time. The configured byte limits include the frame header in each direction.

Source

pub const fn name(&self) -> &'static str

Get the exact exported name.

Source

pub const fn id(&self) -> u64

Get the routing ID derived from the exported name.

Source

pub const fn request_limits(&self) -> Limits

Get the request limits.

Source

pub const fn reply_limits(&self) -> Limits

Get the reply limits.

Source

pub fn encode_request<'de>( &self, value: &Request, output: &mut Vec<u8>, ) -> Result<(), Error>
where Request: Evolving<'de>,

Encode a request frame into reusable output.

§Errors

Returns an encoding or request admission error.

Source

pub fn decode_request<'de>(&self, input: &'de [u8]) -> Result<Request, Error>
where Request: Evolving<'de>,

Decode a request frame for this method.

§Errors

Returns a framing, decoding, incompatibility, or request admission error.

Source

pub fn encode_reply<'de>( &self, value: &Reply, output: &mut Vec<u8>, ) -> Result<(), Error>
where Reply: Evolving<'de>,

Encode a reply frame into reusable output.

§Errors

Returns an encoding or reply admission error.

Source

pub fn decode_reply<'de>(&self, input: &'de [u8]) -> Result<Reply, Error>
where Reply: Evolving<'de>,

Decode a reply frame for this method.

§Errors

Returns a framing, decoding, incompatibility, or reply admission error.

Auto Trait Implementations§

§

impl<Request, Reply> Forget for Method<Request, Reply>

§

impl<Request, Reply> Freeze for Method<Request, Reply>
where &'static str: Freeze, PhantomData<fn() -> (Request, Reply)>: Freeze,

§

impl<Request, Reply> Move for Method<Request, Reply>

§

impl<Request, Reply> RefUnwindSafe for Method<Request, Reply>

§

impl<Request, Reply> Send for Method<Request, Reply>
where &'static str: Send,

§

impl<Request, Reply> Sync for Method<Request, Reply>

§

impl<Request, Reply> Unpin for Method<Request, Reply>
where &'static str: Unpin,

§

impl<Request, Reply> UnsafeUnpin for Method<Request, Reply>

§

impl<Request, Reply> UnwindSafe for Method<Request, Reply>
where &'static str: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.