[][src]Enum jail::param::Type

pub enum Type {
    Int,
    String,
    S64,
    Uint,
    Long,
    Ulong,
    U64,
    U8,
    U16,
    S8,
    S16,
    S32,
    U32,
    Ipv4Addrs,
    Ipv6Addrs,
}

Auto-generated discriminant enum variants

Variants

Int
String
S64
Uint
Long
Ulong
U64
U8
U16
S8
S16
S32
U32
Ipv4Addrs

Represent a list of IPv4 addresses.

Example

use jail::param::Value;
let rfc1918 = Value::Ipv4Addrs(vec![
    "10.0.0.0".parse().unwrap(),
    "172.16.0.0".parse().unwrap(),
    "192.168.0.0".parse().unwrap(),
]);
Ipv6Addrs

Represent a list of IPv6 addresses.

Example

use jail::param::Value;
let all_nodes = Value::Ipv6Addrs(vec![
    "ff01::1".parse().unwrap(),
    "ff02::1".parse().unwrap(),
]);

Implementations

impl Type[src]

pub fn of_param(name: &str) -> Result<Type, JailError>[src]

Get a parameter type from the name

Examples

use jail::param::Type;
assert_eq!(Type::of_param("osreldate").unwrap(), Type::Int);
assert_eq!(Type::of_param("osrelease").unwrap(), Type::String);
assert_eq!(Type::of_param("ip4.addr").unwrap(), Type::Ipv4Addrs);
assert_eq!(Type::of_param("ip6.addr").unwrap(), Type::Ipv6Addrs);

pub fn is_string(&self) -> bool[src]

Check if this type is a string.

Example

use jail::param::Type;
assert_eq!(Type::String.is_string(), true);
assert_eq!(Type::Int.is_string(), false);

pub fn is_numeric(&self) -> bool[src]

Check if this type is numeric

Example

use jail::param::Type;
assert_eq!(Type::Int.is_numeric(), true);
assert_eq!(Type::String.is_numeric(), false);

pub fn is_signed(&self) -> bool[src]

Check if this type is signed

Example

use jail::param::Type;
assert_eq!(Type::Int.is_signed(), true);
assert_eq!(Type::Uint.is_signed(), false);

// Non-numeric types return false
assert_eq!(Type::String.is_signed(), false);

pub fn is_ip(&self) -> bool[src]

Check if this type is an IP address list

Example

use jail::param::Type;
assert_eq!(Type::Ipv4Addrs.is_ip(), true);
assert_eq!(Type::Ipv6Addrs.is_ip(), true);
assert_eq!(Type::String.is_ip(), false);

pub fn is_ipv4(&self) -> bool[src]

Check if this type is an IPv4 address list

Example

use jail::param::Type;
assert_eq!(Type::Ipv4Addrs.is_ipv4(), true);
assert_eq!(Type::Ipv6Addrs.is_ipv4(), false);

pub fn is_ipv6(&self) -> bool[src]

Check if this type is an IPv4 address list

Example

use jail::param::Type;
assert_eq!(Type::Ipv6Addrs.is_ipv6(), true);
assert_eq!(Type::Ipv4Addrs.is_ipv6(), false);

Trait Implementations

impl Clone for Type[src]

impl Copy for Type[src]

impl Debug for Type[src]

impl Eq for Type[src]

impl<'_enum> From<&'_enum Value> for Type[src]

impl From<Value> for Type[src]

impl Hash for Type[src]

impl Into<CtlType> for Type[src]

impl Ord for Type[src]

impl PartialEq<Type> for Type[src]

impl PartialOrd<Type> for Type[src]

impl StructuralEq for Type[src]

impl StructuralPartialEq for Type[src]

Auto Trait Implementations

impl RefUnwindSafe for Type

impl Send for Type

impl Sync for Type

impl Unpin for Type

impl UnwindSafe for Type

Blanket Implementations

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

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

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

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, 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.