[][src]Struct oceanpkg::config::RtConfig

pub struct RtConfig {
    pub start_time: Instant,
    pub current_dir: PathBuf,
    pub user_home: PathBuf,
    pub ocean_home: LazyCell<PathBuf>,
}

Represents the configuration specific to this current instance.

This type exists so as to put creation of commonly-needed values up-front, allowing for errors only needed to be handled in one place.

Fields

start_time: Instant

The time at which the program started. Used for telling how much time has elapsed.

current_dir: PathBuf

The directory where this process was started from.

user_home: PathBuf

The current user's home directory.

ocean_home: LazyCell<PathBuf>

The directory for data stored for the current user.

PlatformPath
Linux & macOS$HOME/.ocean
WindowsUnimplemented

Methods

impl RtConfig[src]

pub fn create() -> Result<Self, CreateError>[src]

Creates a new instance suitable for using at the start of your program.

pub fn create_at(start_time: Instant) -> Result<Self, CreateError>[src]

Creates a new instance suitable for emitting metrics from start_time.

pub fn time_elapsed(&self) -> Duration[src]

Returns the amount of time elapsed since the program started.

pub fn current_dir(&self) -> &Path[src]

The directory where this process was started from.

pub fn ocean_home(&self) -> &Path[src]

The directory where data for the current user is stored.

pub fn user_home(&self) -> &Path[src]

The current user's home directory.

pub fn credentials_path(&self) -> PathBuf[src]

Returns the path for $HOME/.ocean/credentials.toml.

pub fn bin_dir(&self) -> PathBuf[src]

Returns the directory where binaries exposed via $PATH are stored.

pub fn cache_dir(&self) -> PathBuf[src]

Returns Ocean's cache directory.

pub fn tarball_cache_path(&self, query: Query<&str>) -> PathBuf[src]

Returns the path where a tarball for query should be cached.

pub fn drops_dir(&self, target: &InstallTarget) -> Cow<'static, Path>[src]

Returns the directory where drops are installed.

Trait Implementations

impl Clone for RtConfig[src]

impl Debug for RtConfig[src]

Auto Trait Implementations

impl !RefUnwindSafe for RtConfig

impl Send for RtConfig

impl !Sync for RtConfig

impl Unpin for RtConfig

impl UnwindSafe for RtConfig

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 = !

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.