Skip to main content

MethodArgs

Struct MethodArgs 

Source
pub struct MethodArgs<'a> { /* private fields */ }
Expand description

Decoder for the body of a struct method taking two or more arguments.

A single-argument method takes the request body as the argument, which is the shape the wire has always had. Beyond one argument the body carries the whole list, in either of two forms:

  • a JSON/BEVE array of exactly N values, positionally, or
  • an object keyed by parameter name, where a missing key decodes as null (so an Option<T> parameter may be omitted).

Generated code names this, and a hand-written RepeMethods impl that publishes a multi-argument method should too: it is what makes such a table accept the same two body shapes a derived one does, instead of inventing a third that no client of a derived struct would speak. That is why it is public and documented rather than hidden — it carries a wire contract, not an implementation detail.

Implementations§

Source§

impl<'a> MethodArgs<'a>

Source

pub fn new( path: &'a str, names: &'a [&'a str], body: Value, ) -> StructResult<Self>

Split body into the argument list for names.

Source

pub fn next_arg<T: DeserializeOwned>(&mut self) -> StructResult<T>

Decode the next argument in declaration order.

Auto Trait Implementations§

§

impl<'a> Freeze for MethodArgs<'a>

§

impl<'a> RefUnwindSafe for MethodArgs<'a>

§

impl<'a> Send for MethodArgs<'a>

§

impl<'a> Sync for MethodArgs<'a>

§

impl<'a> Unpin for MethodArgs<'a>

§

impl<'a> UnsafeUnpin for MethodArgs<'a>

§

impl<'a> UnwindSafe for MethodArgs<'a>

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, <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.