pub struct Envelope {
pub version: i64,
pub kind: String,
pub method: String,
pub capability: String,
pub args: Value,
pub request_id: String,
pub token: String,
pub error: Option<String>,
}Expand description
One RPC message. Serializes to a msgpack map with the short keys the Python
side uses: v, t, m, c, a, id, tok, err.
Fields§
§version: i64§kind: String“request” | “response” | “event”.
method: String§capability: String§args: Value§request_id: String§token: String§error: Option<String>Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn to_msgpack(&self) -> Result<Vec<u8>, PluginError>
pub fn to_msgpack(&self) -> Result<Vec<u8>, PluginError>
Serialize the envelope to a msgpack map (no length prefix).
Sourcepub fn from_msgpack(body: &[u8]) -> Result<Self, PluginError>
pub fn from_msgpack(body: &[u8]) -> Result<Self, PluginError>
Deserialize an envelope from a msgpack map body (no length prefix).
Sourcepub fn encode_frame(&self) -> Result<Vec<u8>, PluginError>
pub fn encode_frame(&self) -> Result<Vec<u8>, PluginError>
Encode the envelope as a complete length-prefixed frame, ready to write
to the socket. Equivalent to Python encode_frame.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Envelope
impl<'de> Deserialize<'de> for Envelope
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
impl StructuralPartialEq for Envelope
Auto Trait Implementations§
impl Freeze for Envelope
impl RefUnwindSafe for Envelope
impl Send for Envelope
impl Sync for Envelope
impl Unpin for Envelope
impl UnsafeUnpin for Envelope
impl UnwindSafe for Envelope
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