pub struct Envelope {
pub v: u16,
pub id: String,
pub target: String,
pub subject: String,
pub kind: Kind,
pub corr: Option<String>,
pub seq: Option<u64>,
pub hops: Option<u8>,
pub body_token: Option<String>,
pub payload: Bytes,
pub path: Vec<String>,
pub headers: Map<String, Value>,
}Fields§
§v: u16§id: String§target: String§subject: String§kind: Kind§corr: Option<String>§seq: Option<u64>§hops: Option<u8>§body_token: Option<String>§payload: Bytes§path: Vec<String>§headers: Map<String, Value>Implementations§
Source§impl Envelope
impl Envelope
pub fn decode(frame: Bytes) -> Result<Envelope, CoreError>
pub fn decode_head(frame: &[u8]) -> Result<(Envelope, usize), CoreError>
pub fn encode(&self) -> Bytes
pub fn payload_json(&self) -> Value
pub fn encode_payload(value: &Value) -> Bytes
pub fn parse_payload<T: DeserializeOwned>(&self) -> Result<T, CoreError>
pub fn to_request(&self) -> Result<Request<Bytes>, CoreError>
pub fn to_local_request(&self) -> Result<Request<Bytes>, CoreError>
pub fn subject_of(uri: &Uri) -> String
pub fn ensure_headers_wire_safe( headers: &Map<String, Value>, ) -> Result<(), CoreError>
pub fn from_request(request: Request<Bytes>) -> Result<Envelope, CoreError>
pub fn to_response(&self) -> Result<Response<Bytes>, CoreError>
pub fn from_response(response: Response<Bytes>) -> Result<Envelope, CoreError>
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