Skip to main content

Env

Struct Env 

Source
pub struct Env {
    pub home: PathBuf,
    pub config_roots: Vec<PathBuf>,
    pub session: String,
    pub key_dir: Option<PathBuf>,
    pub no_raise: bool,
}
Expand description

Where state lives and where apps keep their settings. Env::from_os for the real thing; tests point both somewhere private.

Fields§

§home: PathBuf

State folder: sessions and default screenshots.

§config_roots: Vec<PathBuf>

Folders searched (a few levels deep) for control-key.local-<port> files.

§session: String

The session used when --session is not given.

§key_dir: Option<PathBuf>

ASHLAR_CONTROL_KEY_DIR, if set: the key folder for connect / --port without --key-dir.

§no_raise: bool

ASHLAR_DEBUG_NO_RAISE: screenshots never raise a covered window (automated runs must not steal focus from the person at the machine).

Implementations§

Source§

impl Env

Source

pub fn from_os() -> Self

ASHLAR_DEBUG_HOME (or the user cache folder + ashlar-debug), the OS settings folders, ASHLAR_DEBUG_SESSION (or default), ASHLAR_DEBUG_NO_RAISE.

Source

pub fn under(root: &Path) -> Self

The folders of from_os under root instead (tests): state in <root>/home, settings searched in <root>/config, nothing taken from the environment.

Source

pub fn sessions_dir(&self) -> PathBuf

Source

pub fn session_file(&self, name: &str) -> PathBuf

Source

pub fn session_dir(&self, name: &str) -> PathBuf

The folder holding a launched app’s key folder and log.

Trait Implementations§

Source§

impl Clone for Env

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Env

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Env

§

impl RefUnwindSafe for Env

§

impl Send for Env

§

impl Sync for Env

§

impl Unpin for Env

§

impl UnsafeUnpin for Env

§

impl UnwindSafe for Env

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.