[][src]Enum controlgroup::DeviceNumber

pub enum DeviceNumber {
    Any,
    Number(u16),
}

Device major/minor number.

DeviceNumber implements FromStr and Display. You can convert a string into a DeviceNumber and vice versa. parse returns an error with kind ErrorKind::Parse if failed.

use controlgroup::DeviceNumber;

let n = "8".parse::<DeviceNumber>().unwrap();
assert_eq!(n, DeviceNumber::Number(8));

let n = "*".parse::<DeviceNumber>().unwrap();
assert_eq!(n, DeviceNumber::Any);
use controlgroup::DeviceNumber;

assert_eq!(DeviceNumber::Number(8).to_string(), "8");
assert_eq!(DeviceNumber::Any.to_string(), "*");

DeviceNumber also implements From<u16>, which results in DeviceNumber::Number.

use controlgroup::DeviceNumber;

assert_eq!(DeviceNumber::from(8), DeviceNumber::Number(8));

Variants

Any

Any number matches.

Number(u16)

Specific number.

Trait Implementations

impl From<u16> for DeviceNumber[src]

impl Clone for DeviceNumber[src]

impl Copy for DeviceNumber[src]

impl Eq for DeviceNumber[src]

impl PartialEq<DeviceNumber> for DeviceNumber[src]

impl Debug for DeviceNumber[src]

impl Display for DeviceNumber[src]

impl FromStr for DeviceNumber[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for DeviceNumber[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]