pub struct RequestMsgData {
pub tid: u16,
pub to: Peer,
pub command: Command,
pub id: Option<[u8; 32]>,
pub token: Option<[u8; 32]>,
pub target: Option<[u8; 32]>,
pub value: Option<Vec<u8>>,
}Expand description
RequestMsgData is the Request data structure that is encoded to/from bytes
Fields§
§tid: u16§to: Peer§command: Command§id: Option<[u8; 32]>§token: Option<[u8; 32]>§target: Option<[u8; 32]>§value: Option<Vec<u8>>Implementations§
Source§impl RequestMsgData
impl RequestMsgData
pub fn from_ids_and_inner_data( tid: u16, id: Option<[u8; 32]>, data: RequestMsgDataInner, ) -> Self
Trait Implementations§
Source§impl Clone for RequestMsgData
impl Clone for RequestMsgData
Source§fn clone(&self) -> RequestMsgData
fn clone(&self) -> RequestMsgData
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 CompactEncoding for RequestMsgData
impl CompactEncoding for RequestMsgData
Source§fn encoded_size(&self) -> Result<usize, EncodingError>
fn encoded_size(&self) -> Result<usize, EncodingError>
The size in bytes required to encode
self.Source§fn encode<'a>(
&self,
buffer: &'a mut [u8],
) -> Result<&'a mut [u8], EncodingError>
fn encode<'a>( &self, buffer: &'a mut [u8], ) -> Result<&'a mut [u8], EncodingError>
Encode
self into buffer returning the remainder of buffer.Source§fn decode(buffer: &[u8]) -> Result<(Self, &[u8]), EncodingError>where
Self: Sized,
fn decode(buffer: &[u8]) -> Result<(Self, &[u8]), EncodingError>where
Self: Sized,
Decode a value from the given
buffer of the type specified by the Decode type parameter
(which defaults to Self). Returns the decoded value and remaining undecoded bytes.Source§fn to_encoded_bytes(&self) -> Result<Box<[u8]>, EncodingError>
fn to_encoded_bytes(&self) -> Result<Box<[u8]>, EncodingError>
Encode
self into a Vec<u8>. This is just a helper method for creating a buffer and
encoding to it in one step. Read moreSource§fn create_buffer(&self) -> Result<Box<[u8]>, EncodingError>
fn create_buffer(&self) -> Result<Box<[u8]>, EncodingError>
Create an empty buffer of the correct size for encoding
self to. This is just a helper
method for: encoding to it in one step. Read moreSource§fn encode_with_len<'a>(
&self,
buffer: &'a mut [u8],
) -> Result<(&'a mut [u8], usize), EncodingError>
fn encode_with_len<'a>( &self, buffer: &'a mut [u8], ) -> Result<(&'a mut [u8], usize), EncodingError>
Like
CompactEncoding::encode but also return the number of bytes encoded.Source§fn decode_with_len(
buffer: &[u8],
) -> Result<(Decode, &[u8], usize), EncodingError>where
Decode: Sized,
fn decode_with_len(
buffer: &[u8],
) -> Result<(Decode, &[u8], usize), EncodingError>where
Decode: Sized,
Like
CompactEncoding::decode but also return the number of bytes decoded.Source§impl Debug for RequestMsgData
impl Debug for RequestMsgData
Source§impl PartialEq for RequestMsgData
impl PartialEq for RequestMsgData
Source§fn eq(&self, other: &RequestMsgData) -> bool
fn eq(&self, other: &RequestMsgData) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RequestMsgData
Auto Trait Implementations§
impl Freeze for RequestMsgData
impl RefUnwindSafe for RequestMsgData
impl Send for RequestMsgData
impl Sync for RequestMsgData
impl Unpin for RequestMsgData
impl UnsafeUnpin for RequestMsgData
impl UnwindSafe for RequestMsgData
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