pub struct Snapshot<'repo> { /* private fields */ }
Expand description

A platform to access configuration values as read from disk.

Note that these values won’t update even if the underlying file(s) change.

Implementations

Access configuration values, frozen in time, using a key which is a . separated string of up to three tokens, namely section_name.[subsection_name.]value_name, like core.bare or remote.origin.url.

Note that single-value methods always return the last value found, which is the one set most recently in the hierarchy of configuration files, aka ‘last one wins’.

Return the boolean at key, or None if there is no such value or if the value can’t be interpreted as boolean.

For a non-degenerating version, use try_boolean(…).

Note that this method takes the most recent value at key even if it is from a file with reduced trust.

Like boolean(), but it will report an error if the value couldn’t be interpreted as boolean.

Return the resolved integer at key, or None if there is no such value or if the value can’t be interpreted as integer or exceeded the value range.

For a non-degenerating version, use try_integer(…).

Note that this method takes the most recent value at key even if it is from a file with reduced trust.

Like integer(), but it will report an error if the value couldn’t be interpreted as boolean.

Return the string at key, or None if there is no such value.

Note that this method takes the most recent value at key even if it is from a file with reduced trust.

Return the trusted and fully interpolated path at key, or None if there is no such value or if no value was found in a trusted file. An error occours if the path could not be interpolated to its final value.

Utilities and additional access

Returns the underlying configuration implementation for a complete API, despite being a little less convenient.

It’s expected that more functionality will move up depending on demand.

Trait Implementations

Formats the value using the given formatter. Read more

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.