Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 16 fields pub threads: Setting<Count>, pub memory_max: Setting<Amount>, pub memory_ceiling: Setting<Amount>, pub memory_split: Setting<bool>, pub cache_enabled: Setting<bool>, pub cache_dir: Setting<CacheDir>, pub cache_max: Setting<Amount>, pub cache_ceiling: Setting<Bytes>, pub cache_tiers: Setting<Tiers>, pub cache_min_dex: Setting<Bytes>, pub cache_write_queue: Setting<Bytes>, pub cache_writers: Setting<Count>, pub cache_spill: Setting<Bytes>, pub daemon_idle: Setting<Seconds>, pub daemon_wait: Setting<Millis>, pub file: Option<PathBuf>,
}
Expand description

The resolved settings (Config::resolve).

Fields§

§threads: Setting<Count>§memory_max: Setting<Amount>§memory_ceiling: Setting<Amount>§memory_split: Setting<bool>§cache_enabled: Setting<bool>§cache_dir: Setting<CacheDir>§cache_max: Setting<Amount>§cache_ceiling: Setting<Bytes>§cache_tiers: Setting<Tiers>§cache_min_dex: Setting<Bytes>§cache_write_queue: Setting<Bytes>§cache_writers: Setting<Count>§cache_spill: Setting<Bytes>§daemon_idle: Setting<Seconds>§daemon_wait: Setting<Millis>§file: Option<PathBuf>

The config file read, if any.

Implementations§

Source§

impl Config

Source

pub const KEYS: &'static [Key]

Source

pub fn entries(&self) -> Vec<(&'static Key, String, Source, bool)>

(key, value text, source, computed from the machine) of every setting, in Config::KEYS order.

Source§

impl Config

Source

pub fn file_path(env: impl Fn(&str) -> Option<String>) -> Option<PathBuf>

The config file: $ASC_CONFIG (empty: none), else $XDG_CONFIG_HOME/asc/config.toml, else ~/.config/asc/config.toml.

Source

pub fn load(flags: &[(String, String)]) -> Result<Config, ConfigError>

Read the process’s environment and config file, then apply flags ((key, value) pairs from the command line).

Source

pub fn resolve( file: Option<(&Path, &str)>, env: impl Fn(&str) -> Option<String>, flags: &[(String, String)], ) -> Result<Config, ConfigError>

Defaults, then the file (path, text), then env, then flags.

Source

pub fn flag_pairs(&self) -> Vec<(String, String)>

The (key, value) pairs of the settings given on the command line, to hand on to a process started for this one (a daemon).

Source

pub fn threads(&self) -> Threads

Source

pub fn fixed_threads(&self) -> Option<usize>

Config::threads as an explicit count, None for auto.

Source

pub fn memory_policy(&self, device: &Device) -> Option<MemoryPolicy>

How an automatic memory cache follows device; None for a fixed size.

Source

pub fn memory_bytes(&self, device: &Device) -> usize

The memory cache’s starting size on device.

Source

pub fn cache_dir(&self) -> Option<PathBuf>

The cache directory in use (None: the cache is off, or no default directory could be determined).

Source

pub fn disk_capacity(&self) -> DiskCapacity

Source

pub fn disk_cache(&self) -> Option<DiskCache>

The disk cache, unless it is off.

Source

pub fn one_shot_cache(&self) -> CacheConfig

The cache of a one-shot command: the disk cache only.

Source

pub fn resident_cache(&self, device: &Device) -> CacheConfig

The cache of a resident host (mcp, the daemon) on device.

Trait Implementations§

Source§

impl Clone for Config

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 Config

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Config

Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin for Config

§

impl UnwindSafe for Config

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> Same for T

Source§

type Output = T

Should always be Self
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.