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.
§Panics
Panics if an item in the list is not a valid IP
§Examples
let print_ip = |ip: net::Ipv4Addr| -> Result<(), ScanError> {
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(),
]
);
ips.lazy_loop(print_ip).unwrap();Implementations§
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