Struct smoltcp::wire::Ipv4Address
source · [−]pub struct Ipv4Address(pub [u8; 4]);Expand description
A four-octet IPv4 address.
Tuple Fields
0: [u8; 4]Implementations
sourceimpl Address
impl Address
sourcepub const UNSPECIFIED: Address = Address([0x00; 4])
pub const UNSPECIFIED: Address = Address([0x00; 4])
An unspecified address.
sourcepub const MULTICAST_ALL_SYSTEMS: Address = Address([224, 0, 0, 1])
pub const MULTICAST_ALL_SYSTEMS: Address = Address([224, 0, 0, 1])
All multicast-capable nodes
sourcepub const MULTICAST_ALL_ROUTERS: Address = Address([224, 0, 0, 2])
pub const MULTICAST_ALL_ROUTERS: Address = Address([224, 0, 0, 2])
All multicast-capable routers
sourcepub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
pub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
Construct an IPv4 address from parts.
sourcepub fn from_bytes(data: &[u8]) -> Address
pub fn from_bytes(data: &[u8]) -> Address
Construct an IPv4 address from a sequence of octets, in big-endian.
Panics
The function panics if data is not four octets long.
sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Query whether the address is an unicast address.
sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Query whether the address is the broadcast address.
sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Query whether the address is a multicast address.
sourcepub const fn is_unspecified(&self) -> bool
pub const fn is_unspecified(&self) -> bool
Query whether the address falls into the “unspecified” range.
sourcepub fn is_link_local(&self) -> bool
pub fn is_link_local(&self) -> bool
Query whether the address falls into the “link-local” range.
sourcepub const fn is_loopback(&self) -> bool
pub const fn is_loopback(&self) -> bool
Query whether the address falls into the “loopback” range.
Trait Implementations
sourceimpl From<Address> for Address
impl From<Address> for Address
sourcefn from(addr: Ipv4Address) -> Self
fn from(addr: Ipv4Address) -> Self
Converts to this type from the input type.
sourceimpl FromStr for Ipv4Address
impl FromStr for Ipv4Address
sourcefn from_str(s: &str) -> Result<Ipv4Address, ()>
fn from_str(s: &str) -> Result<Ipv4Address, ()>
Parse a string representation of an IPv4 address.
type Err = ()
type Err = ()
The associated error which can be returned from parsing.
sourceimpl Hash for Address
impl Hash for Address
sourcefn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher]. Read more
1.3.0fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
sourceimpl Ord for Address
impl Ord for Address
sourceimpl PartialOrd<Address> for Address
impl PartialOrd<Address> for Address
sourcefn partial_cmp(&self, other: &Address) -> Option<Ordering>
fn partial_cmp(&self, other: &Address) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0fn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0fn le(&self, other: &Rhs) -> bool
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
impl Copy for Address
impl Eq for Address
impl StructuralEq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more