pub struct InterfaceBuilder { /* private fields */ }
Expand description
A builder for constructing Interface
instances.
The InterfaceBuilder
struct provides a fluent API for building
Interface
objects. It allows you to chain method calls to set various
fields, culminating in a build()
method that constructs the Interface
.
§Examples
use interface_rs::interface::{Interface, Family};
let iface = Interface::builder("eth0")
.with_auto(true)
.with_allow("hotplug")
.with_family(Family::Inet)
.with_method("dhcp")
.with_option("mtu", "1500")
.build();
Implementations§
Source§impl InterfaceBuilder
impl InterfaceBuilder
Sourcepub fn with_allow(self, allow: impl Into<String>) -> Self
pub fn with_allow(self, allow: impl Into<String>) -> Self
Sourcepub fn with_family(self, family: Family) -> Self
pub fn with_family(self, family: Family) -> Self
Sourcepub fn with_method(self, method: impl Into<String>) -> Self
pub fn with_method(self, method: impl Into<String>) -> Self
Sourcepub fn with_mapping(self, mapping: Mapping) -> Self
pub fn with_mapping(self, mapping: Mapping) -> Self
Sets the mapping configuration for the interface.
§Arguments
mapping
- AMapping
struct representing the mapping configuration.
§Examples
use interface_rs::interface::{Interface, Mapping};
let mapping = Mapping {
script: "/usr/local/bin/map-script".to_string(),
maps: vec!["eth0".to_string()],
};
let builder = Interface::builder("eth0")
.with_mapping(mapping);
Trait Implementations§
Source§impl Clone for InterfaceBuilder
impl Clone for InterfaceBuilder
Source§fn clone(&self) -> InterfaceBuilder
fn clone(&self) -> InterfaceBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for InterfaceBuilder
impl RefUnwindSafe for InterfaceBuilder
impl Send for InterfaceBuilder
impl Sync for InterfaceBuilder
impl Unpin for InterfaceBuilder
impl UnwindSafe for InterfaceBuilder
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
)