heim_net/os/
macos.rs

1//! macOS-specific extensions.
2//!
3//! Available only for `cfg(target_os = "macos")`
4
5use crate::Address;
6
7/// macOS-specific extension for [Nic].
8///
9/// [Nic]: ../../struct.Nic.html
10pub trait NicExt {
11    /// Returns broadcast address if available.
12    fn broadcast(&self) -> Option<Address>;
13
14    /// Returns `bool` indicating whether interface is broadcast.
15    fn is_broadcast(&self) -> bool;
16
17    /// Returns `bool` indicating whether interface is point-to-point.
18    fn is_point_to_point(&self) -> bool;
19}
20
21#[cfg(target_os = "macos")]
22impl NicExt for crate::Nic {
23    fn broadcast(&self) -> Option<Address> {
24        self.as_ref().broadcast()
25    }
26
27    fn is_broadcast(&self) -> bool {
28        self.as_ref().is_broadcast()
29    }
30
31    fn is_point_to_point(&self) -> bool {
32        self.as_ref().is_point_to_point()
33    }
34}