Enum nmstate::Interface

source ·
#[non_exhaustive]
pub enum Interface {
Show 18 variants Bond(BondInterface), Dummy(DummyInterface), Ethernet(EthernetInterface), Hsr(HsrInterface), LinuxBridge(LinuxBridgeInterface), OvsBridge(OvsBridgeInterface), OvsInterface(OvsInterface), Unknown(UnknownInterface), Vlan(VlanInterface), Vxlan(VxlanInterface), MacVlan(MacVlanInterface), MacVtap(MacVtapInterface), Vrf(VrfInterface), InfiniBand(InfiniBandInterface), Loopback(LoopbackInterface), MacSec(MacSecInterface), Ipsec(IpsecInterface), Xfrm(XfrmInterface),
}
Expand description

Represent a kernel or user space network interface.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Bond(BondInterface)

§

Dummy(DummyInterface)

Dummy interface.

§

Ethernet(EthernetInterface)

Ethernet interface or virtual ethernet(veth) of linux kernel

§

Hsr(HsrInterface)

HSR interface provided by Linux kernel.

§

LinuxBridge(LinuxBridgeInterface)

Bridge provided by Linux kernel.

§

OvsBridge(OvsBridgeInterface)

OpenvSwitch bridge.

§

OvsInterface(OvsInterface)

OpenvSwitch system interface.

§

Unknown(UnknownInterface)

Unknown interface.

§

Vlan(VlanInterface)

VLAN interface.

§

Vxlan(VxlanInterface)

VxLAN interface.

§

MacVlan(MacVlanInterface)

MAC VLAN interface.

§

MacVtap(MacVtapInterface)

MAC VTAP interface.

§

Vrf(VrfInterface)

§

InfiniBand(InfiniBandInterface)

§

Loopback(LoopbackInterface)

Linux loopback interface

§

MacSec(MacSecInterface)

MACsec interface.

§

Ipsec(IpsecInterface)

Ipsec connection

§

Xfrm(XfrmInterface)

Linux xfrm interface

Implementations§

source§

impl Interface

source

pub fn name(&self) -> &str

The interface name.

source

pub fn iface_type(&self) -> InterfaceType

The interface type

source

pub fn is_up(&self) -> bool

Whether interface is up, default to true.

source

pub fn is_absent(&self) -> bool

Whether interface is marked as absent.

source

pub fn is_down(&self) -> bool

Whether interface is marked as down.

source

pub fn is_ignore(&self) -> bool

Whether interface is marked as ignore.

source

pub fn is_virtual(&self) -> bool

Whether interface is virtual(can delete from kernel). Since loopback interface should not be deleted from system, hence we consider loopback interface as not virtual interface. Unknown interface is considered as not virtual interface.

source

pub fn need_controller(&self) -> bool

Whether current interface only lives when its control exists. For example, OpenvSwitch system interface can only exists when its controller OpenvSwitch bridge exists.

source

pub fn base_iface(&self) -> &BaseInterface

Get reference of its BaseInterface.

source

pub fn base_iface_mut(&mut self) -> &mut BaseInterface

source

pub fn ports(&self) -> Option<Vec<&str>>

The name of ports. Return None if its is not controller or not mentioned port section

source§

impl Interface

source

pub fn update(&mut self, other: &Interface)

Trait Implementations§

source§

impl Clone for Interface

source§

fn clone(&self) -> Interface

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Interface

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Interface

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Interface

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for Interface

source§

fn eq(&self, other: &Interface) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Interface

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Interface

source§

impl StructuralPartialEq for Interface

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

source§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,