Struct blart::ToOctets

source ·
pub struct ToOctets<IP>(PhantomData<IP>);
Expand description

This struct represents a conversion of IP addresses (V4 and V6) into their component bytes. The ordering of IP addresses is already the lexicographic ordering of the component bytes, so it will be preserved.

Tuple Fields§

§0: PhantomData<IP>

Trait Implementations§

source§

impl BytesMapping for ToOctets<Ipv4Addr>

§

type Bytes = [u8; 4]

The bytestring type that the Self::Domain is converted to.
§

type Domain = Ipv4Addr

The unconverted type that has a specific ordering
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type
source§

impl BytesMapping for ToOctets<Ipv6Addr>

§

type Bytes = [u8; 16]

The bytestring type that the Self::Domain is converted to.
§

type Domain = Ipv6Addr

The unconverted type that has a specific ordering
source§

fn to_bytes(value: Self::Domain) -> Self::Bytes

Convert the domain type into the bytestring type
source§

fn from_bytes(bytes: Self::Bytes) -> Self::Domain

Convert the bytestring type back into the domain type

Auto Trait Implementations§

§

impl<IP> RefUnwindSafe for ToOctets<IP>where IP: RefUnwindSafe,

§

impl<IP> Send for ToOctets<IP>where IP: Send,

§

impl<IP> Sync for ToOctets<IP>where IP: Sync,

§

impl<IP> Unpin for ToOctets<IP>where IP: Unpin,

§

impl<IP> UnwindSafe for ToOctets<IP>where IP: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.