[−][src]Struct reef::Env
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Env
[src]
impl Ord for Env
[src]
fn cmp(&self, other: &Env) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Env> for Env
[src]
impl PartialOrd<Env> for Env
[src]
fn partial_cmp(&self, other: &Env) -> Option<Ordering>
[src]
fn lt(&self, other: &Env) -> bool
[src]
fn le(&self, other: &Env) -> bool
[src]
fn gt(&self, other: &Env) -> bool
[src]
fn ge(&self, other: &Env) -> bool
[src]
impl Serialize for Env
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,