[][src]Struct reef::Env

pub struct Env {
    pub username: String,
    pub hostname: String,
    pub distro: String,
    pub realname: String,
    pub devicename: String,
}

Metadata about the environment

Fields

username: String

The username

hostname: String

The hostname,

distro: String

The distro

realname: String

The real name for the user

devicename: String

The device name

Implementations

impl Env[src]

pub fn which(name: &str) -> Result<PathBuf>[src]

uses the PATH environment variable to search for a filename matching the specified name. if a matching filename is not found, it will check for the existence of name.exe and name.bat

Example

use reef::Env;
let git_path = Env::which("git").unwrap();
assert!(git_path.exists());

pub fn shebang(path: &Path) -> Result<String>[src]

extracts the text following the shebang #!

Example

given a file with the contents:

#!C:/Ruby26-x64/bin/ruby.exe

the shebang method will return C:/Ruby26-x64/bin/ruby.exe

use reef::Env;
use std::env;
let path = std::env::temp_dir().join("test.rb");
std::fs::write(&path,b"#!C:/Ruby26-x64/bin/ruby.exe")?;
let target = Env::shebang(&path).unwrap();
assert_eq!("C:/Ruby26-x64/bin/ruby.exe",target);

Trait Implementations

impl Clone for Env[src]

impl Debug for Env[src]

impl Default for Env[src]

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

impl Eq for Env[src]

impl Ord for Env[src]

impl PartialEq<Env> for Env[src]

impl PartialOrd<Env> for Env[src]

impl Serialize for Env[src]

impl StructuralEq for Env[src]

impl StructuralPartialEq for Env[src]

Auto Trait Implementations

impl RefUnwindSafe for Env

impl Send for Env

impl Sync for Env

impl Unpin for Env

impl UnwindSafe for Env

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, 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<V, T> VZip<V> for T where
    V: MultiLane<T>,