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 anOption<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>
impl<'a> MethodArgs<'a>
Sourcepub fn new(
path: &'a str,
names: &'a [&'a str],
body: Value,
) -> StructResult<Self>
pub fn new( path: &'a str, names: &'a [&'a str], body: Value, ) -> StructResult<Self>
Split body into the argument list for names.
Sourcepub fn next_arg<T: DeserializeOwned>(&mut self) -> StructResult<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more