pub struct Ipv4AddrExt { /* private fields */ }Implementations§
Source§impl Ipv4AddrExt
impl Ipv4AddrExt
Sourcepub fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4AddrExt
pub fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4AddrExt
Creates a new IPv4AddrExt from four eight-bit octets.
Sourcepub fn largest_identical_prefix<T: Into<Ipv4AddrExt>>(&self, target: T) -> u8
pub fn largest_identical_prefix<T: Into<Ipv4AddrExt>>(&self, target: T) -> u8
Returns the largest identical prefix of two IP address.
§Example
use subnetwork::Ipv4AddrExt;
use subnetwork::Ipv4Pool;
use std::net::Ipv4Addr;
fn main() {
let ipv4_1 = Ipv4Addr::new(192, 168, 1, 136);
let ipv4_2 = Ipv4Addr::new(192, 168, 1, 192);
let ipv4ext_1: Ipv4AddrExt = ipv4_1.into();
let ret = ipv4ext_1.largest_identical_prefix(ipv4_2);
assert_eq!(ret, 25);
}Trait Implementations§
Source§impl Clone for Ipv4AddrExt
impl Clone for Ipv4AddrExt
Source§fn clone(&self) -> Ipv4AddrExt
fn clone(&self) -> Ipv4AddrExt
Returns a duplicate 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 Ipv4AddrExt
impl Debug for Ipv4AddrExt
Source§impl Display for Ipv4AddrExt
impl Display for Ipv4AddrExt
Source§impl From<Ipv4Addr> for Ipv4AddrExt
impl From<Ipv4Addr> for Ipv4AddrExt
Source§impl From<Ipv4AddrExt> for Ipv4Addr
impl From<Ipv4AddrExt> for Ipv4Addr
Source§fn from(addr: Ipv4AddrExt) -> Self
fn from(addr: Ipv4AddrExt) -> Self
Converts to this type from the input type.
Source§impl FromStr for Ipv4AddrExt
impl FromStr for Ipv4AddrExt
impl Copy for Ipv4AddrExt
Auto Trait Implementations§
impl Freeze for Ipv4AddrExt
impl RefUnwindSafe for Ipv4AddrExt
impl Send for Ipv4AddrExt
impl Sync for Ipv4AddrExt
impl Unpin for Ipv4AddrExt
impl UnwindSafe for Ipv4AddrExt
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