pub struct Interface {
pub name: String,
pub auto: bool,
pub allow: Vec<String>,
pub family: Option<Family>,
pub method: Option<String>,
pub options: Vec<(String, String)>,
pub mapping: Option<Mapping>,
}
Expand description
Represents a network interface configuration in an interfaces(5)
file.
The Interface
struct encapsulates all the configuration details for a
network interface, including its name, whether it starts automatically,
allowed hotplug options, address family, method of configuration, and
additional options.
§Examples
Creating a new Interface
:
use interface_rs::interface::{Interface, Family};
let iface = Interface {
name: "eth0".to_string(),
auto: true,
allow: vec!["hotplug".to_string()],
family: Some(Family::Inet),
method: Some("dhcp".to_string()),
options: vec![],
mapping: None,
};
Fields§
§name: String
The name of the interface (e.g., "eth0"
).
auto: bool
Indicates if the interface is set to start automatically.
allow: Vec<String>
A list of allow-*
directives associated with the interface.
family: Option<Family>
The address family (e.g., inet
).
method: Option<String>
The method of configuration (e.g., "static"
, "dhcp"
).
options: Vec<(String, String)>
A list of options specified under the iface
stanza.
mapping: Option<Mapping>
Optional mapping configuration for the interface.
Trait Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)