pub struct IPTargets(/* private fields */);Expand description
Represents a list of IP targets
This wrapper is used to cut down on the memory needed to store entire network IP ranges. Rather than storing all 65536 IPs in a /16 CIDR block, or a range of IPS, this wrapper allows the storage of just CIDR or range in string form and then dynamically loops the IPs in that block when needed.
§Errors
Returns an error if an item in the list is not a valid IP, CIDR block, or range
§Examples
let print_ip = |ip: net::Ipv4Addr| -> Result<()> {
println!("ip: {}", ip);
Ok(())
};
let ips = IPTargets::new(
vec![
"192.168.0.1".to_string(),
"172.17.0.1-172.17.0.24".to_string(),
"192.168.68.1/24".to_string(),
]
).unwrap();
ips.lazy_loop(print_ip).unwrap();Implementations§
Source§impl IPTargets
impl IPTargets
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IPTargets
impl RefUnwindSafe for IPTargets
impl Send for IPTargets
impl Sync for IPTargets
impl Unpin for IPTargets
impl UnwindSafe for IPTargets
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more