pub enum RpcMessage {
Request {
msgid: u32,
method: String,
params: Value,
},
Response {
msgid: u32,
error: Value,
result: Value,
},
Notify {
method: String,
params: Value,
},
}Expand description
A single RPC message on the wire.
Variants§
Request
Caller asks for a method invocation; expects a Response with matching msgid.
Response
Reply to a Request with the same msgid. Exactly one of error/result
is meaningful; the other should be nil (Value::Nil).
Notify
One-way message; no Response is expected.
Implementations§
Source§impl RpcMessage
impl RpcMessage
Sourcepub fn request(msgid: u32, method: impl Into<String>, params: Value) -> Self
pub fn request(msgid: u32, method: impl Into<String>, params: Value) -> Self
Construct a Request.
Sourcepub fn response_ok(msgid: u32, result: Value) -> Self
pub fn response_ok(msgid: u32, result: Value) -> Self
Construct a Response carrying a successful result. error is set to Nil.
Sourcepub fn response_err(msgid: u32, error: Value) -> Self
pub fn response_err(msgid: u32, error: Value) -> Self
Construct a Response carrying an error. result is set to Nil.
Trait Implementations§
Source§impl Clone for RpcMessage
impl Clone for RpcMessage
Source§fn clone(&self) -> RpcMessage
fn clone(&self) -> RpcMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RpcMessage
impl Debug for RpcMessage
Source§impl<'de> Deserialize<'de> for RpcMessage
impl<'de> Deserialize<'de> for RpcMessage
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encoder<RpcMessage> for FrameCodec
impl Encoder<RpcMessage> for FrameCodec
Source§impl PartialEq for RpcMessage
impl PartialEq for RpcMessage
Source§fn eq(&self, other: &RpcMessage) -> bool
fn eq(&self, other: &RpcMessage) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RpcMessage
impl Serialize for RpcMessage
impl StructuralPartialEq for RpcMessage
Auto Trait Implementations§
impl Freeze for RpcMessage
impl RefUnwindSafe for RpcMessage
impl Send for RpcMessage
impl Sync for RpcMessage
impl Unpin for RpcMessage
impl UnsafeUnpin for RpcMessage
impl UnwindSafe for RpcMessage
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