#[non_exhaustive]pub enum Metered {
Unknown,
Yes,
No,
GuessYes,
GuessNo,
}v1_2 only.Expand description
The NMMetered enum has two different purposes: one is to configure “connection.metered” setting of a connection profile in #NMSettingConnection, and the other is to express the actual metered state of the #NMDevice at a given moment.
For the connection profile only #NM_METERED_UNKNOWN, #NM_METERED_NO and #NM_METERED_YES are allowed.
The device’s metered state at runtime is determined by the profile which is currently active. If the profile explicitly specifies #NM_METERED_NO or #NM_METERED_YES, then the device’s metered state is as such. If the connection profile leaves it undecided at #NM_METERED_UNKNOWN (the default), then NetworkManager tries to guess the metered state, for example based on the device type or on DHCP options (like Android devices exposing a “ANDROID_METERED” DHCP vendor option). This then leads to either #NM_METERED_GUESS_NO or #NM_METERED_GUESS_YES.
Most applications probably should treat the runtime state #NM_METERED_GUESS_YES like #NM_METERED_YES, and all other states as not metered.
Note that the per-device metered states are then combined to a global metered state. This is basically the metered state of the device with the best default route. However, that generalization of a global metered state may not be correct if the default routes for IPv4 and IPv6 are on different devices, or if policy routing is configured. In general, the global metered state tries to express whether the traffic is likely metered, but since that depends on the traffic itself, there is not one answer in all cases. Hence, an application may want to consider the per-device’s metered states.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unknown
The metered status is unknown
Yes
Metered, the value was explicitly configured
No
Not metered, the value was explicitly configured
GuessYes
Metered, the value was guessed
GuessNo
Not metered, the value was guessed
Trait Implementations§
Source§impl<'a> FromValue<'a> for Metered
impl<'a> FromValue<'a> for Metered
Source§type Checker = GenericValueTypeChecker<Metered>
type Checker = GenericValueTypeChecker<Metered>
Source§unsafe fn from_value(value: &'a Value) -> Self
unsafe fn from_value(value: &'a Value) -> Self
Value. Read moreSource§impl HasParamSpec for Metered
impl HasParamSpec for Metered
Source§impl Ord for Metered
impl Ord for Metered
Source§impl PartialOrd for Metered
impl PartialOrd for Metered
Source§impl StaticType for Metered
impl StaticType for Metered
Source§fn static_type() -> Type
fn static_type() -> Type
Self.impl Copy for Metered
impl Eq for Metered
impl StructuralPartialEq for Metered
Auto Trait Implementations§
impl Freeze for Metered
impl RefUnwindSafe for Metered
impl Send for Metered
impl Sync for Metered
impl Unpin for Metered
impl UnwindSafe for Metered
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> IntoClosureReturnValue for T
impl<T> IntoClosureReturnValue for T
fn into_closure_return_value(self) -> Option<Value>
Source§impl<T> PropertyGet for Twhere
T: HasParamSpec,
impl<T> PropertyGet for Twhere
T: HasParamSpec,
Source§impl<T> StaticTypeExt for Twhere
T: StaticType,
impl<T> StaticTypeExt for Twhere
T: StaticType,
Source§fn ensure_type()
fn ensure_type()
Source§impl<T> ToSendValue for T
impl<T> ToSendValue for T
Source§fn to_send_value(&self) -> SendValue
fn to_send_value(&self) -> SendValue
SendValue clone of self.