pub struct Config {}
Expand description

Struct for Apt Configuration

All apt configuration methods do not require this struct. You can call the bindings directly from raw::apt if you would like.

Implementations

Create a new config object and safely init the config system.

If you initialize the struct without new() or default() You will need to manually initialize the config system.

Clears all configuratations, re-initialize, and returns the config object.

Resets the configurations.

If you’d like to clear everything and NOT reinit you can call self.clear_all or apt::config_clear_all directly

Clears all values from a key.

If the value is a list, the entire list is cleared. If you need to clear 1 value from a list see self.clear_value

Clear a single value from a list. Used for removing one item in an apt configuruation list

Clears all configuratations.

This will leave you with an empty configuration object and most things probably won’t work right.

Returns a string dump of configuration options separated by \n

Find a key and return it’s value as a string.

default is what will be returned if nothing is found.

Exactly like find but takes no default and returns an option instead.

Find a file and return it’s value as a string.

default is what will be returned if nothing is found.

key = "Dir::Cache::pkgcache" should return /var/cache/apt/pkgcache.bin

There is not much difference in self.dir and self.file

dir will return with a trailing / where file will not.

Find a directory and return it’s value as a string.

default is what will be returned if nothing is found.

key = "Dir::Etc::sourceparts" should return /etc/apt/sources.list.d/

There is not much difference in self.dir and self.file

dir will return with a trailing / where file will not.

Same as find, but for boolean values.

Same as find, but for i32 values.

Return a vector for an Apt configuration list.

An example of a common key that contains a list APT::NeverAutoRemove.

Simply check if a key exists.

Set the given key to the specified value.

Add strings from a vector into an apt configuration list.

If the configuration key is not a list, you will receive a vector with one item.

Example:

use rust_apt::config::Config;
let config = Config::new();

let apt_list = vec!["This", "is", "my", "apt", "list"];
// Using "AptList" here will not work and will panic.
config.set_vector("AptList", &apt_list);

Trait Implementations

Create a new config object and safely init the config system.

If you initialize the struct without new() or default() You will need to manually initialize the config system.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.