pub struct Request<'a> {
pub jsonrpc: TwoPointZero,
pub id: Id<'a>,
pub method: Cow<'a, str>,
pub params: Option<Cow<'a, RawValue>>,
}Expand description
JSON-RPC request object as defined in the spec.
Fields§
§jsonrpc: TwoPointZeroJSON-RPC version.
id: Id<'a>Request ID
method: Cow<'a, str>Name of the method to be invoked.
params: Option<Cow<'a, RawValue>>Parameter values of the request.
Decoding borrows them from the input, so a request with params only decodes from borrowed
input such as serde_json::from_str or serde_json::from_slice.
Implementations§
Source§impl<'a> Request<'a>
impl<'a> Request<'a>
Sourcepub fn borrowed(
method: &'a str,
params: Option<&'a RawValue>,
id: Id<'a>,
) -> Self
pub fn borrowed( method: &'a str, params: Option<&'a RawValue>, id: Id<'a>, ) -> Self
Create new borrowed Request.
Sourcepub fn owned(method: String, params: Option<Box<RawValue>>, id: Id<'a>) -> Self
pub fn owned(method: String, params: Option<Box<RawValue>>, id: Id<'a>) -> Self
Create new owned Request.
Sourcepub fn method_name(&self) -> &str
pub fn method_name(&self) -> &str
Get the method name of the request.
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Request<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Request<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<'a> Freeze for Request<'a>
impl<'a> RefUnwindSafe for Request<'a>
impl<'a> Send for Request<'a>
impl<'a> Sync for Request<'a>
impl<'a> Unpin for Request<'a>
impl<'a> UnsafeUnpin for Request<'a>
impl<'a> UnwindSafe for Request<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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: 72 bytes