pub struct IPSet { /* private fields */ }Expand description
Wrapper for ipset instance in c.
Implementations§
Source§impl IPSet
impl IPSet
Sourcepub fn new() -> IPSet
pub fn new() -> IPSet
Create a new IPSet instance.
Examples found in repository?
examples/usage.rs (line 106)
96fn main() {
97 if let Err(err) = test_hash_ip() {
98 println!("test hash ip failed:{:?}", err);
99 }
100
101 if let Err(err) = test_bitmap_ip() {
102 println!("test bitmap failed:{:?}", err);
103 }
104
105 if fs::metadata("test.ipset").is_ok() {
106 let set = IPSet::new();
107 set.restore("test.ipset".to_string()).unwrap();
108 println!("restore ok");
109 fs::remove_file("test.ipset").unwrap();
110 } else {
111 println!("test.ipset not found");
112 }
113}Sourcepub fn restore(&self, filename: String) -> Result<(), Error>
pub fn restore(&self, filename: String) -> Result<(), Error>
Restore a set from a file.
Examples found in repository?
examples/usage.rs (line 107)
96fn main() {
97 if let Err(err) = test_hash_ip() {
98 println!("test hash ip failed:{:?}", err);
99 }
100
101 if let Err(err) = test_bitmap_ip() {
102 println!("test bitmap failed:{:?}", err);
103 }
104
105 if fs::metadata("test.ipset").is_ok() {
106 let set = IPSet::new();
107 set.restore("test.ipset".to_string()).unwrap();
108 println!("restore ok");
109 fs::remove_file("test.ipset").unwrap();
110 } else {
111 println!("test.ipset not found");
112 }
113}Trait Implementations§
Auto Trait Implementations§
impl Freeze for IPSet
impl RefUnwindSafe for IPSet
impl !Send for IPSet
impl !Sync for IPSet
impl Unpin for IPSet
impl UnwindSafe for IPSet
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