pub struct TransmitCounter { /* private fields */ }Implementations§
source§impl TransmitCounter
impl TransmitCounter
sourcepub fn get_egress(&self) -> u64
pub fn get_egress(&self) -> u64
Get the number of bytes transmitted.
Examples found in repository?
examples/ex_socket_filter.rs (line 12)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let open_object = Box::leak(Box::new(MaybeUninit::uninit()));
let socket_filter = socket_filter::TransmitCounter::new(
&["lo", "podman", "veth", "flannel", "cni0", "utun"],
open_object,
);
loop {
println!(
"current bytes: {} {}",
socket_filter.get_egress(),
socket_filter.get_ingress()
);
sleep(Duration::from_secs(1));
}
}sourcepub fn get_ingress(&self) -> u64
pub fn get_ingress(&self) -> u64
Get the number of bytes received.
Examples found in repository?
examples/ex_socket_filter.rs (line 13)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let open_object = Box::leak(Box::new(MaybeUninit::uninit()));
let socket_filter = socket_filter::TransmitCounter::new(
&["lo", "podman", "veth", "flannel", "cni0", "utun"],
open_object,
);
loop {
println!(
"current bytes: {} {}",
socket_filter.get_egress(),
socket_filter.get_ingress()
);
sleep(Duration::from_secs(1));
}
}sourcepub fn new(
ignored_interfaces: &[&'static str],
open_object: &'static mut MaybeUninit<OpenObject>,
) -> Self
pub fn new( ignored_interfaces: &[&'static str], open_object: &'static mut MaybeUninit<OpenObject>, ) -> Self
Create a new TransmitCounter instance.
ignored_interfaces is a list of interface names to ignore.
Examples found in repository?
examples/ex_socket_filter.rs (lines 5-8)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let open_object = Box::leak(Box::new(MaybeUninit::uninit()));
let socket_filter = socket_filter::TransmitCounter::new(
&["lo", "podman", "veth", "flannel", "cni0", "utun"],
open_object,
);
loop {
println!(
"current bytes: {} {}",
socket_filter.get_egress(),
socket_filter.get_ingress()
);
sleep(Duration::from_secs(1));
}
}Auto Trait Implementations§
impl Freeze for TransmitCounter
impl RefUnwindSafe for TransmitCounter
impl Send for TransmitCounter
impl Sync for TransmitCounter
impl Unpin for TransmitCounter
impl !UnwindSafe for TransmitCounter
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