pub struct Interface { /* private fields */ }Expand description
The inferface struct
Implementations§
Source§impl Interface
impl Interface
Sourcepub fn addrs(&self) -> Result<SmallVec<IfNet>>
pub fn addrs(&self) -> Result<SmallVec<IfNet>>
Returns a list of unicast interface addrs for a specific interface.
Sourcepub fn addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<IfNet>>
pub fn addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<IfNet>>
Returns a list of unicast interface addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.addrs_by_filter(|addr| { addr.is_loopback() }).unwrap();
for addr in addrs {
println!("Addr: {}", addr);
}Sourcepub fn ipv4_addrs(&self) -> Result<SmallVec<Ifv4Net>>
pub fn ipv4_addrs(&self) -> Result<SmallVec<Ifv4Net>>
Returns a list of unicast, IPv4 interface addrs for a specific interface.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv4_addrs().unwrap();
for addr in addrs {
println!("IPv4 Addr: {}", addr);
}Sourcepub fn ipv4_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<Ifv4Net>>
pub fn ipv4_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<Ifv4Net>>
Returns a list of unicast, IPv4 interface addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv4_addrs_by_filter(|addr| {
!addr.is_loopback()
}).unwrap();
for addr in addrs {
println!("IPv4 Addr: {}", addr);
}Sourcepub fn ipv6_addrs(&self) -> Result<SmallVec<Ifv6Net>>
pub fn ipv6_addrs(&self) -> Result<SmallVec<Ifv6Net>>
Returns a list of unicast, IPv6 interface addrs for a specific interface.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv6_addrs().unwrap();
for addr in addrs {
println!("IPv6 Addr: {}", addr);
}Sourcepub fn ipv6_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<Ifv6Net>>
pub fn ipv6_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<Ifv6Net>>
Returns a list of unicast, IPv6 interface addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv6_addrs_by_filter(|addr| {
!addr.is_loopback()
}).unwrap();
for addr in addrs {
println!("IPv6 Addr: {}", addr);
}Sourcepub fn multicast_addrs(&self) -> Result<SmallVec<IfAddr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn multicast_addrs(&self) -> Result<SmallVec<IfAddr>>
Returns a list of multicast, joined group addrs for a specific interface.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.multicast_addrs().unwrap();
for addr in addrs {
println!("Multicast Addr: {}", addr);
}Sourcepub fn multicast_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<IfAddr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn multicast_addrs_by_filter<F>(&self, f: F) -> Result<SmallVec<IfAddr>>
Returns a list of multicast, joined group addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.multicast_addrs_by_filter(|addr| {
!addr.is_loopback()
}).unwrap();
for addr in addrs {
println!("Multicast Addr: {}", addr);
}Sourcepub fn ipv4_multicast_addrs(&self) -> Result<SmallVec<Ifv4Addr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn ipv4_multicast_addrs(&self) -> Result<SmallVec<Ifv4Addr>>
Returns a list of multicast, joined group IPv4 addrs for a specific interface.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv4_multicast_addrs().unwrap();
for addr in addrs {
println!("Multicast IPv4 Addr: {}", addr);
}Sourcepub fn ipv4_multicast_addrs_by_filter<F>(
&self,
f: F,
) -> Result<SmallVec<Ifv4Addr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn ipv4_multicast_addrs_by_filter<F>( &self, f: F, ) -> Result<SmallVec<Ifv4Addr>>
Returns a list of multicast, joined group IPv4 addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv4_multicast_addrs_by_filter(|addr| {
!addr.is_loopback()
}).unwrap();
for addr in addrs {
println!("Multicast IPv4 Addr: {}", addr);
}Sourcepub fn ipv6_multicast_addrs(&self) -> Result<SmallVec<Ifv6Addr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn ipv6_multicast_addrs(&self) -> Result<SmallVec<Ifv6Addr>>
Returns a list of multicast, joined group IPv6 addrs for a specific interface.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv6_multicast_addrs().unwrap();
for addr in addrs {
println!("Multicast IPv6 Addr: {}", addr);
}Sourcepub fn ipv6_multicast_addrs_by_filter<F>(
&self,
f: F,
) -> Result<SmallVec<Ifv6Addr>>
Available on Apple or FreeBSD or Linux or Windows only.
pub fn ipv6_multicast_addrs_by_filter<F>( &self, f: F, ) -> Result<SmallVec<Ifv6Addr>>
Returns a list of multicast, joined group IPv6 addrs for a specific interface. The filter is used to determine which multicast addresses to include.
§Example
use getifs::interfaces;
let interface = interfaces().unwrap().into_iter().next().unwrap();
let addrs = interface.ipv6_multicast_addrs_by_filter(|addr| {
!addr.is_loopback()
}).unwrap();
for addr in addrs {
println!("Multicast IPv6 Addr: {}", addr);
}Trait Implementations§
impl Eq for Interface
impl StructuralPartialEq for Interface
Auto Trait Implementations§
impl Freeze for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnwindSafe for Interface
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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