[−][src]Struct cjdns_ctrl::PingData
Body data for ping type control messages
Fields
version: u32
key: Option<CJDNSPublicKey>
content: Vec<u8>
Implementations
impl PingData
[src]
pub const MIN_SIZE: usize
[src]
Minimum ping data size
pub fn parse(bytes: &[u8], ping: CtrlMessageType) -> Result<Self, ParseError>
[src]
Parses raw bytes into PingData
.
Result in error in several situations:
- input bytes length is less than
PingData::MIN_SIZE
- encoded ping magic is not equal to magic defined for the inputted
ping
- if input
ping
is sort of key pings, but bytes data size is too small to create cjdns public key from it
pub fn serialize(
&self,
ping: CtrlMessageType
) -> Result<Vec<u8>, SerializeError>
[src]
&self,
ping: CtrlMessageType
) -> Result<Vec<u8>, SerializeError>
Serialized PingData
instance.
PingData
type can be instantiated directly, without using parse
method.
That's why serialization can result in errors in several situations:
- instance has version of 0
ping
variable, which is defined by control message serialize method, has key ping/pong type, butkey
is not specified in the data instance
Trait Implementations
impl Clone for PingData
[src]
impl Debug for PingData
[src]
impl Eq for PingData
[src]
impl PartialEq<PingData> for PingData
[src]
impl StructuralEq for PingData
[src]
impl StructuralPartialEq for PingData
[src]
Auto Trait Implementations
impl RefUnwindSafe for PingData
impl Send for PingData
impl Sync for PingData
impl Unpin for PingData
impl UnwindSafe for PingData
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<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>,