pub struct ControlMessage {
pub opcode: u16,
pub request_id: u32,
pub sender_id: u32,
pub transition_id: u32,
pub args_length: u32,
pub args: ByteBuf,
}Expand description
Control plane message that travels on Stream 0.
Fields§
§opcode: u16Opcode (see gbp_core::ControlOpcode).
request_id: u32Request identifier (echoed in ACK / NACK).
sender_id: u32Sender’s member id.
transition_id: u32Related transition_id.
args_length: u32Declared length of args.
args: ByteBufOpcode-specific CBOR arguments.
Implementations§
Source§impl ControlMessage
impl ControlMessage
Sourcepub fn bare(
opcode: u16,
request_id: u32,
sender_id: u32,
transition_id: u32,
) -> ControlMessage
pub fn bare( opcode: u16, request_id: u32, sender_id: u32, transition_id: u32, ) -> ControlMessage
Builds an argument-less message.
Sourcepub fn with_args(
opcode: u16,
request_id: u32,
sender_id: u32,
transition_id: u32,
args: Vec<u8>,
) -> ControlMessage
pub fn with_args( opcode: u16, request_id: u32, sender_id: u32, transition_id: u32, args: Vec<u8>, ) -> ControlMessage
Builds a message with raw CBOR arguments.
Sourcepub fn from_cbor(data: &[u8]) -> Result<ControlMessage, CodecError>
pub fn from_cbor(data: &[u8]) -> Result<ControlMessage, CodecError>
Decodes a CBOR-encoded message and validates args_length.
Trait Implementations§
Source§impl Clone for ControlMessage
impl Clone for ControlMessage
Source§fn clone(&self) -> ControlMessage
fn clone(&self) -> ControlMessage
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 ControlMessage
impl Debug for ControlMessage
Source§impl<'de> Deserialize<'de> for ControlMessage
impl<'de> Deserialize<'de> for ControlMessage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ControlMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ControlMessage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ControlMessage
impl Serialize for ControlMessage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ControlMessage
impl RefUnwindSafe for ControlMessage
impl Send for ControlMessage
impl Sync for ControlMessage
impl Unpin for ControlMessage
impl UnsafeUnpin for ControlMessage
impl UnwindSafe for ControlMessage
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,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
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