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,
) -> Self
pub fn bare( opcode: u16, request_id: u32, sender_id: u32, transition_id: u32, ) -> Self
Builds an argument-less message.
Sourcepub fn with_args(
opcode: u16,
request_id: u32,
sender_id: u32,
transition_id: u32,
args: Vec<u8>,
) -> Self
pub fn with_args( opcode: u16, request_id: u32, sender_id: u32, transition_id: u32, args: Vec<u8>, ) -> Self
Builds a message with raw CBOR arguments.
Sourcepub fn from_cbor(data: &[u8]) -> Result<Self, CodecError>
pub fn from_cbor(data: &[u8]) -> Result<Self, 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<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 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