pub struct AssessmentEnvelope {
pub source_node: String,
pub sequence: u64,
pub message: AssessmentMessage,
}Expand description
Thin envelope wrapping AssessmentMessage with routing metadata.
This is the JSON payload inside a FrameType::AssessmentSync frame.
Fields§
§source_node: StringSource node identifier.
sequence: u64Monotonic sequence number for dedup.
message: AssessmentMessageThe inner protocol message.
Implementations§
Source§impl AssessmentEnvelope
impl AssessmentEnvelope
Sourcepub fn to_bytes(&self) -> KernelResult<Vec<u8>>
pub fn to_bytes(&self) -> KernelResult<Vec<u8>>
Serialize to JSON bytes.
Sourcepub fn from_bytes(data: &[u8]) -> KernelResult<Self>
pub fn from_bytes(data: &[u8]) -> KernelResult<Self>
Deserialize from JSON bytes.
Sourcepub fn to_frame(&self) -> KernelResult<MeshFrame>
pub fn to_frame(&self) -> KernelResult<MeshFrame>
Wrap this envelope in a MeshFrame for wire transmission.
Sourcepub fn from_frame(frame: &MeshFrame) -> KernelResult<Self>
pub fn from_frame(frame: &MeshFrame) -> KernelResult<Self>
Decode an AssessmentEnvelope from a MeshFrame.
Returns Err if the frame type is not AssessmentSync or the
payload cannot be deserialized.
Trait Implementations§
Source§impl Clone for AssessmentEnvelope
impl Clone for AssessmentEnvelope
Source§impl Debug for AssessmentEnvelope
impl Debug for AssessmentEnvelope
Source§impl<'de> Deserialize<'de> for AssessmentEnvelope
impl<'de> Deserialize<'de> for AssessmentEnvelope
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 Freeze for AssessmentEnvelope
impl RefUnwindSafe for AssessmentEnvelope
impl Send for AssessmentEnvelope
impl Sync for AssessmentEnvelope
impl Unpin for AssessmentEnvelope
impl UnsafeUnpin for AssessmentEnvelope
impl UnwindSafe for AssessmentEnvelope
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>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more