[][src]Struct pathfix::config::PathFlags

pub struct PathFlags { /* fields omitted */ }

Flags for a Path

PathFlags describes the requirements that the system must fulfill so that the Path will be included to the $PATH string.

Examples

Parse the PathFlags and check the current system.

use pathfix::config::{PathFlags, IncludeAdministrative};

let flags: PathFlags = "admin".parse().unwrap();
assert!(flags.check(PathFlags::this_system(&IncludeAdministrative::Always)));

Implementations

impl PathFlags[src]

pub fn new() -> PathFlags[src]

Creates empty PathFlags without any requirements.

Examples

use pathfix::config::PathFlags;

println!("{}", PathFlags::new());

pub fn check(self, given: PathFlags) -> bool[src]

Checks if the PathFlags are given for the flags of the given system.

Example

Check if default flags are met.

use pathfix::config::{PathFlags, IncludeAdministrative};
assert!(
    PathFlags::new().check(
        PathFlags::this_system(&IncludeAdministrative::Always)
    )
);

pub fn this_system<I>(include_administrative: &I) -> PathFlags where
    I: Borrow<IncludeAdministrative>, 
[src]

Get given PathFlags for this system.

Example

Test if current system is Linux.

use pathfix::config::{PathFlags, IncludeAdministrative};

let requirements: PathFlags = "linux".parse().unwrap();
let this_system = PathFlags::this_system(&IncludeAdministrative::Always);

assert_eq!(requirements.check(this_system), cfg!(target_os = "linux"));

Trait Implementations

impl Clone for PathFlags[src]

impl Copy for PathFlags[src]

impl Debug for PathFlags[src]

impl Default for PathFlags[src]

impl<'de> Deserialize<'de> for PathFlags[src]

impl Display for PathFlags[src]

impl Eq for PathFlags[src]

impl FromStr for PathFlags[src]

type Err = Error

The associated error which can be returned from parsing.

impl Ord for PathFlags[src]

impl PartialEq<PathFlags> for PathFlags[src]

impl PartialOrd<PathFlags> for PathFlags[src]

impl Serialize for PathFlags[src]

impl StructuralEq for PathFlags[src]

impl StructuralPartialEq for PathFlags[src]

Auto Trait Implementations

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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> 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.