[−][src]Struct cjdns_sniff::CtrlMessage
Serialized control message
Fields
msg_type: CtrlMessageType
msg_data: CtrlMessageData
Implementations
impl CtrlMessage
[src]
pub const HEADER_SIZE: usize
[src]
Control message header size, which is considered as minimum size message bytes to parsed.
Actually, message size should be greater than is stated in this constant, but this is checked further
in CtrlMessage
"sub-parsers".
pub fn parse(bytes: &[u8]) -> Result<CtrlMessage, ParseError>
[src]
Parses raw bytes into CtrlMessage
.
Result in error in several situations:
- input bytes length is less then
CtrlMessage::HEADER_SIZE
- input data got invalid checksum
- unrecognized control message type code was parsed
- control message body parsing methods failed. For more information about this read documentation for corresponding message data structs (i.e.
PingData
,ErrorData
)
pub fn serialize(&self) -> Result<Vec<u8>, SerializeError>
[src]
Serializes CtrlMessage
instance.
CtrlMessage
type can be instantiated directly, without using parse
method.
That's why serialization can result in errors in several situations:
- instantiated message with different header and body types. For example, message with error type stated in header and ping data will fail serialization
- error/ping data serialization failed
pub fn get_error_data(&self) -> Option<&ErrorData>
[src]
pub fn get_ping_data(&self) -> Option<&PingData>
[src]
Trait Implementations
impl Clone for CtrlMessage
[src]
pub fn clone(&self) -> CtrlMessage
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CtrlMessage
[src]
impl Eq for CtrlMessage
[src]
impl PartialEq<CtrlMessage> for CtrlMessage
[src]
pub fn eq(&self, other: &CtrlMessage) -> bool
[src]
pub fn ne(&self, other: &CtrlMessage) -> bool
[src]
impl StructuralEq for CtrlMessage
[src]
impl StructuralPartialEq for CtrlMessage
[src]
Auto Trait Implementations
impl RefUnwindSafe for CtrlMessage
impl Send for CtrlMessage
impl Sync for CtrlMessage
impl Unpin for CtrlMessage
impl UnwindSafe for CtrlMessage
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,