#[non_exhaustive]pub struct Config {Show 22 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 decompile_default: Setting<Name>,
pub decompile_fallback: Setting<Names>,
pub decompile_mapping: Setting<MaybePath>,
pub decompile_auto_install: Setting<bool>,
pub decompile_release_url: Setting<Name>,
pub file: Option<PathBuf>,
pub decompilers: BTreeMap<String, Decompiler>,
}Expand description
The resolved settings (Config::resolve).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.threads: Setting<Count>threads: worker threads per process; auto: the CPUs, 4 per CPU split between busy asc processes.
memory_max: Setting<Amount>memory.max: memory cache of mcp and the daemon; auto = 25%: of available memory, split between resident processes.
memory_ceiling: Setting<Amount>memory.ceiling: most one process’s automatic memory cache takes (a % is of physical memory); auto: 1/16 of it, 2G..8G.
memory_split: Setting<bool>memory.split: split the automatic memory budget between the user’s resident processes.
cache_enabled: Setting<bool>cache.enabled: read and write the disk cache.
cache_dir: Setting<CacheDir>cache.dir: disk cache directory; default: $XDG_CACHE_HOME/asc, else %LOCALAPPDATA%\asc\cache on Windows, else ~/.cache/asc.
cache_max: Setting<Amount>cache.max: disk cache budget; auto = 20%: of free space plus the cache, at most cache.ceiling, never into a 1 GiB / 5% reserve.
cache_ceiling: Setting<Bytes>cache.ceiling: most the automatic disk budget takes.
cache_tiers: Setting<Tiers>cache.tiers: disk cache tiers in use: dex (L1), derived (L2), rendered (L3).
cache_min_dex: Setting<Bytes>cache.min_dex: smallest inflated DEX written to L1 (smaller ones are cheaper to inflate again).
cache_write_queue: Setting<Bytes>cache.write_queue: heap queued disk writes may hold (at most the memory cache’s budget); later ones inflate again when written.
cache_writers: Setting<Count>cache.writers: disk writer threads per process; auto: 1 per 8 CPUs, 1..4.
cache_spill: Setting<Bytes>cache.spill: budget of out/ in the cache directory, where cut outputs go; 0 writes none.
daemon_idle: Setting<Seconds>daemon.idle: the daemon exits after this long without a request.
daemon_wait: Setting<Millis>daemon.wait: how long the first command waits for the daemon it starts, then runs itself.
decompile_default: Setting<Name>decompile.default: backend of asc decompile unless –decompiler names one (a [decompilers.NAME] table, or the built-in dexdec).
decompile_fallback: Setting<Names>decompile.fallback: backends tried in order when the default one fails on a whole class; none: smali right away.
decompile_mapping: Setting<MaybePath>decompile.mapping: R8 / ProGuard mapping.txt whose names decompiled source shows (–mapping); none: the DEX’s own names.
decompile_auto_install: Setting<bool>decompile.auto_install: download asc-dexdec-worker speaking this asc’s protocol version from decompile.release_url when no worker is found.
decompile_release_url: Setting<Name>decompile.release_url: where asc install and the auto-install fetch the worker: URL/asc-dexdec-worker-pPROTOCOL-TARGET.tar.gz.
file: Option<PathBuf>The config file read, if any.
decompilers: BTreeMap<String, Decompiler>[decompilers.<name>] tables of the config file, by name.
Implementations§
Source§impl Config
impl Config
Sourcepub fn file_path(env: impl Fn(&str) -> Option<String>) -> Option<PathBuf>
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 on Windows
%APPDATA%\\asc\\config.toml, else ~/.config/asc/config.toml.
Sourcepub fn load(flags: &[(String, String)]) -> Result<Config, ConfigError>
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).
§Errors
ConfigError::File when the config file exists but cannot be read,
and the errors of Config::resolve.
Sourcepub fn resolve(
file: Option<(&Path, &str)>,
env: impl Fn(&str) -> Option<String>,
flags: &[(String, String)],
) -> Result<Config, ConfigError>
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.
§Errors
ConfigError::File when the file is not valid TOML,
ConfigError::UnknownKey for a name not in Config::KEYS, and
ConfigError::Invalid for a value that does not parse.
Sourcepub fn flag_pairs(&self) -> Vec<(String, String)>
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).
Sourcepub fn fixed_threads(&self) -> Option<usize>
pub fn fixed_threads(&self) -> Option<usize>
Config::threads as an explicit count, None for auto.
Sourcepub fn memory_policy(&self, device: &Device) -> Option<MemoryPolicy>
pub fn memory_policy(&self, device: &Device) -> Option<MemoryPolicy>
How an automatic memory cache follows device; None for a fixed size.
Sourcepub fn memory_bytes(&self, device: &Device) -> usize
pub fn memory_bytes(&self, device: &Device) -> usize
The memory cache’s starting size on device.
Sourcepub fn cache_dir(&self) -> Option<PathBuf>
pub fn cache_dir(&self) -> Option<PathBuf>
The cache directory in use (None: the cache is off, or no default
directory could be determined).
Sourcepub fn disk_capacity(&self) -> DiskCapacity
pub fn disk_capacity(&self) -> DiskCapacity
The disk cache budget from cache.max and cache.ceiling.
Sourcepub fn disk_cache(&self) -> Option<DiskCache>
pub fn disk_cache(&self) -> Option<DiskCache>
The disk cache, unless it is off.
Sourcepub fn one_shot_cache(&self) -> CacheConfig
pub fn one_shot_cache(&self) -> CacheConfig
The cache of a one-shot command: the disk cache only.
Sourcepub fn resident_cache(&self, device: &Device) -> CacheConfig
pub fn resident_cache(&self, device: &Device) -> CacheConfig
The cache of a resident host (mcp, the daemon) on device.