Struct network_endian::NetworkEndianU16 [−][src]
#[repr(C, packed)]pub struct NetworkEndianU16(_);
Modelled as a packed 2-byte array rather than an u16 because (a) it is not native endian and (b) its alignment is not necessary 2 bytes (it's actually 1).
Methods
impl NetworkEndianU16
[src]
impl NetworkEndianU16
pub const Zero: Self
Zero: Self = NetworkEndianU16([0, 0])
Zero.
pub const Maximum: Self
Maximum: Self = NetworkEndianU16([255, 255])
Maximum.
pub const fn from_network_endian(network_endian: [u8; 2]) -> Self
[src]
pub const fn from_network_endian(network_endian: [u8; 2]) -> Self
From network endian.
pub fn to_network_endian(self) -> u16
[src]
pub fn to_network_endian(self) -> u16
To network endian.
pub fn to_native_endian(self) -> u16
[src]
pub fn to_native_endian(self) -> u16
To native endian.
pub fn from_native_endian(native_endian: u16) -> Self
[src]
pub fn from_native_endian(native_endian: u16) -> Self
From native endian.
pub fn is_not_zero(self) -> bool
[src]
pub fn is_not_zero(self) -> bool
Is not zero.
Trait Implementations
impl Default for NetworkEndianU16
[src]
impl Default for NetworkEndianU16
fn default() -> NetworkEndianU16
[src]
fn default() -> NetworkEndianU16
Returns the "default value" for a type. Read more
impl Debug for NetworkEndianU16
[src]
impl Debug for NetworkEndianU16
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Copy for NetworkEndianU16
[src]
impl Copy for NetworkEndianU16
impl Clone for NetworkEndianU16
[src]
impl Clone for NetworkEndianU16
fn clone(&self) -> NetworkEndianU16
[src]
fn clone(&self) -> NetworkEndianU16
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for NetworkEndianU16
[src]
impl Eq for NetworkEndianU16
impl PartialEq for NetworkEndianU16
[src]
impl PartialEq for NetworkEndianU16
fn eq(&self, other: &NetworkEndianU16) -> bool
[src]
fn eq(&self, other: &NetworkEndianU16) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &NetworkEndianU16) -> bool
[src]
fn ne(&self, other: &NetworkEndianU16) -> bool
This method tests for !=
.
impl Hash for NetworkEndianU16
[src]
impl Hash for NetworkEndianU16
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialOrd for NetworkEndianU16
[src]
impl PartialOrd for NetworkEndianU16
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for NetworkEndianU16
[src]
impl Ord for NetworkEndianU16
fn cmp(&self, other: &Self) -> Ordering
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Into<[u8; 2]> for NetworkEndianU16
[src]
impl Into<[u8; 2]> for NetworkEndianU16
impl From<[u8; 2]> for NetworkEndianU16
[src]
impl From<[u8; 2]> for NetworkEndianU16
impl NetworkEndian for NetworkEndianU16
[src]
impl NetworkEndian for NetworkEndianU16
const Size: usize
Size: usize = 2
Size in bytes.
type Bytes = [u8; 2]
Implements [u8; Self::Size]
but this can not yet be expressed in Rust.
fn to_bytes(self) -> Self::Bytes
[src]
fn to_bytes(self) -> Self::Bytes
Convert into bytes.
fn bytes(&self) -> &[u8]
[src]
fn bytes(&self) -> &[u8]
Underlying bytes.
fn write_to_hash<H: Hasher>(&self, hasher: &mut H)
[src]
fn write_to_hash<H: Hasher>(&self, hasher: &mut H)
Writes to a hasher creating a hash.
impl Display for NetworkEndianU16
[src]
impl Display for NetworkEndianU16
Auto Trait Implementations
impl Send for NetworkEndianU16
impl Send for NetworkEndianU16
impl Sync for NetworkEndianU16
impl Sync for NetworkEndianU16