pub struct Section<'a> { /* private fields */ }
Expand description

A section in a git-config file, like [core] or [remote "origin"], along with all of its keys.

Implementations§

Instantiation and conversion

Create a new section with the given name and optional, subsection, meta-data and an empty body.

Access

Return our header.

Return the unique id of the section, for use with the *_by_id() family of methods in git_config::File.

Return our body, containing all keys and values.

Serialize this type into a BString for convenience.

Note that to_string() can also be used, but might not be lossless.

Stream ourselves to the given out, in order to reproduce this section mostly losslessly as it was parsed.

Return additional information about this sections origin.

Returns a mutable version of this section for adjustment of values.

Methods from Deref<Target = Body<'a>>§

Retrieves the last matching value in a section with the given key, if present.

Note that we consider values without key separator = non-existing.

Retrieves the last matching value in a section with the given key, if present, and indicates an implicit value with Some(None), and a non-existing one as None

Retrieves all values that have the provided key name. This may return an empty vec, which implies there were no values with the provided key.

Returns an iterator visiting all keys in order.

Returns true if the section containss the provided key.

Returns the number of values in the section.

Returns if the section is empty. Note that this may count whitespace, see num_values() for another way to determine semantic emptiness.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. 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
Checks if this value is equivalent to the given key. 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
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.