Struct subnetwork::Ipv6
source · pub struct Ipv6 { /* private fields */ }Implementations§
source§impl Ipv6
impl Ipv6
sourcepub fn new(address: Ipv6Addr) -> Result<Ipv6, AddrParseError>
pub fn new(address: Ipv6Addr) -> Result<Ipv6, AddrParseError>
Constructs a new Ipv6 from a given Ipv6Addr.
sourcepub fn from(address: &str) -> Result<Ipv6, AddrParseError>
pub fn from(address: &str) -> Result<Ipv6, AddrParseError>
Constructs a new Ipv6 from a given &str.
sourcepub fn iter(&self, netmask: usize) -> Ipv6Pool ⓘ
pub fn iter(&self, netmask: usize) -> Ipv6Pool ⓘ
Returns an Ipv6 iterator over the addresses contained in the network.
Example
use subnetwork::Ipv6;
fn main() {
let ipv6 = Ipv6::from("::ffff:192.10.2.255").unwrap();
for i in ipv6.iter(124) {
println!("{:?}", i);
}
}sourcepub fn within_from_str(
&self,
subnet_address: &str
) -> Result<bool, InvalidInputError>
pub fn within_from_str( &self, subnet_address: &str ) -> Result<bool, InvalidInputError>
Check if the ip is within a subnet.
Example
use subnetwork::Ipv6;
fn main() {
let ipv6 = Ipv6::from("::ffff:192.10.2.255").unwrap();
let ret = ipv6.within_from_str("::ffff:192.10.2.255/120").unwrap();
assert_eq!(ret, true);
}sourcepub fn within(&self, subnet_address: Ipv6Pool) -> bool
pub fn within(&self, subnet_address: Ipv6Pool) -> bool
Check if the ip is within a subnet.
Example
use subnetwork::{Ipv6, Ipv6Pool};
fn main() {
let ipv6 = Ipv6::from("::ffff:192.10.2.255").unwrap();
let ipv6_pool = Ipv6Pool::from("::ffff:192.10.2.255/120").unwrap();
let ret = ipv6.within(ipv6_pool);
assert_eq!(ret, true);
}sourcepub fn network(&self, netmask: usize) -> Ipv6Addr
pub fn network(&self, netmask: usize) -> Ipv6Addr
Returns the address of the network denoted by this Ipv6.
This means the lowest possible IP address inside of the network.
sourcepub fn broadcast(&self, netmask: usize) -> Ipv6Addr
pub fn broadcast(&self, netmask: usize) -> Ipv6Addr
Returns the broadcasting address of this Ipv6.
This means the highest possible IP address inside of the network.
sourcepub fn size(&self, netmask: usize) -> usize
pub fn size(&self, netmask: usize) -> usize
Returns the number of possible host addresses in this Ipv6
Trait Implementations§
impl Copy for Ipv6
Auto Trait Implementations§
impl RefUnwindSafe for Ipv6
impl Send for Ipv6
impl Sync for Ipv6
impl Unpin for Ipv6
impl UnwindSafe for Ipv6
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