pub struct SubnetMask { /* private fields */ }
Expand description
A bitmask which represents the boundary between the Network part and Host part of an IPv4 address.
Implementations§
Source§impl SubnetMask
impl SubnetMask
Sourcepub const fn new(prefix_length: PrefixLength<Ipv4>) -> Self
pub const fn new(prefix_length: PrefixLength<Ipv4>) -> Self
Constructs a new SubnetMask
.
Sourcepub fn octets(&self) -> [u8; 4]
pub fn octets(&self) -> [u8; 4]
Returns a byte-array representation of the SubnetMask
in Network (Big-Endian) byte-order.
Sourcepub fn apply_to(&self, target: &Ipv4Addr) -> Ipv4Addr
pub fn apply_to(&self, target: &Ipv4Addr) -> Ipv4Addr
Returns the network address resulting from masking the argument.
Sourcepub fn broadcast_of(&self, target: &Ipv4Addr) -> Ipv4Addr
pub fn broadcast_of(&self, target: &Ipv4Addr) -> Ipv4Addr
Computes the broadcast address for the argument.
Sourcepub fn subnet_size(&self) -> u32
pub fn subnet_size(&self) -> u32
Returns the size of the subnet defined by this mask.
Trait Implementations§
Source§impl Clone for SubnetMask
impl Clone for SubnetMask
Source§fn clone(&self) -> SubnetMask
fn clone(&self) -> SubnetMask
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SubnetMask
impl Debug for SubnetMask
Source§impl<'de> Deserialize<'de> for SubnetMask
impl<'de> Deserialize<'de> for SubnetMask
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FidlCompatible<Ipv4Address> for SubnetMask
impl FidlCompatible<Ipv4Address> for SubnetMask
type FromError = Error
type IntoError = Infallible
fn try_from_fidl(fidl: Ipv4Address) -> Result<Self, Self::FromError>
fn try_into_fidl(self) -> Result<Ipv4Address, Self::IntoError>
Source§impl From<SubnetMask> for Ipv4Addr
impl From<SubnetMask> for Ipv4Addr
Source§fn from(value: SubnetMask) -> Self
fn from(value: SubnetMask) -> Self
Converts to this type from the input type.
Source§impl From<SubnetMask> for PrefixLength<Ipv4>
impl From<SubnetMask> for PrefixLength<Ipv4>
Source§fn from(value: SubnetMask) -> Self
fn from(value: SubnetMask) -> Self
Converts to this type from the input type.
Source§impl PartialEq for SubnetMask
impl PartialEq for SubnetMask
Source§impl Serialize for SubnetMask
impl Serialize for SubnetMask
Source§impl TryFrom<Ipv4Addr> for SubnetMask
impl TryFrom<Ipv4Addr> for SubnetMask
impl Copy for SubnetMask
impl StructuralPartialEq for SubnetMask
Auto Trait Implementations§
impl Freeze for SubnetMask
impl RefUnwindSafe for SubnetMask
impl Send for SubnetMask
impl Sync for SubnetMask
impl Unpin for SubnetMask
impl UnwindSafe for SubnetMask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoAny for T
impl<T> IntoAny for T
§impl<F, C> IntoFidlExt<F> for Cwhere
C: FidlCompatible<F, IntoError = Infallible>,
impl<F, C> IntoFidlExt<F> for Cwhere
C: FidlCompatible<F, IntoError = Infallible>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.