Skip to main content

Config

Struct Config 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

pub const KEYS: &'static [Key]

Every setting, in declaration order.

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 on Windows %APPDATA%\\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).

§Errors

ConfigError::File when the config file exists but cannot be read, and the errors of Config::resolve.

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.

§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.

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

The threads setting as the engine takes it.

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

The disk cache budget from cache.max and cache.ceiling.

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.