pub struct Params<'a>(/* private fields */);Expand description
Parameters sent with an incoming JSON-RPC request.
The data containing the params is a Cow<&str> and can either be a borrowed &str of JSON from
an incoming super::request::Request (which in turn borrows it from the input buffer that is
shared between requests); or, it can be an owned String.
Implementations§
Source§impl<'a> Params<'a>
impl<'a> Params<'a>
Sourcepub fn sequence(&self) -> ParamsSequence<'_>
pub fn sequence(&self) -> ParamsSequence<'_>
Obtain a sequence parser, ParamsSequence.
This allows sequential parsing of the incoming params, using an Iterator-style API and is
useful when the RPC request has optional parameters at the tail that may or may not be
present.
Sourcepub fn parse<T>(&'a self) -> Result<T, ErrorObjectOwned>where
T: Deserialize<'a>,
pub fn parse<T>(&'a self) -> Result<T, ErrorObjectOwned>where
T: Deserialize<'a>,
Attempt to parse all parameters as an array or map into type T.
Sourcepub fn one<T>(&'a self) -> Result<T, ErrorObjectOwned>where
T: Deserialize<'a>,
pub fn one<T>(&'a self) -> Result<T, ErrorObjectOwned>where
T: Deserialize<'a>,
Attempt to parse parameters as an array of a single value of type T, and returns that
value.
Sourcepub fn into_owned(self) -> Params<'static>
pub fn into_owned(self) -> Params<'static>
Convert Params<'a> to Params<'static> so that it can be moved across threads.
This will cause an allocation if the params internally are using a borrowed JSON slice.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Params<'a>
impl<'a> RefUnwindSafe for Params<'a>
impl<'a> Send for Params<'a>
impl<'a> Sync for Params<'a>
impl<'a> Unpin for Params<'a>
impl<'a> UnsafeUnpin for Params<'a>
impl<'a> UnwindSafe for Params<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes