Struct git_config::file::MutableSection[][src]

pub struct MutableSection<'borrow, 'event> { /* fields omitted */ }
Expand description

A opaque type that represents a mutable reference to a section.

Implementations

Adds an entry to the end of this section.

Removes all events until a key value pair is removed. This will also remove the whitespace preceding the key value pair, if any is found.

Sets the last key value pair if it exists, or adds the new value. Returns the previous value if it replaced a value, or None if it adds the value.

Removes the latest value by key and returns it, if it exists.

Adds a new line event. Note that you don’t need to call this unless you’ve disabled implicit newlines.

Enables or disables automatically adding newline events after adding a value. This is enabled by default.

Sets the number of spaces before the start of a key value. By default, this is set to two. Set to 0 to disable adding whitespace before a key value.

Returns the number of whitespace this section will insert before the beginning of a key.

Methods from Deref<Target = SectionBody<'event>>

Retrieves the last matching value in a section with the given key. Returns None if the key was not found.

Retrieves the last matching value in a section with the given key, and attempts to convert the value into the provided type.

Errors

Returns an error if the key was not found, or if the conversion failed.

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

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

Errors

Returns an error if the conversion failed.

Returns an iterator visiting all keys in order.

Checks if the section contains the provided key.

Returns the number of entries in the section.

Returns if the section is empty.

Trait Implementations

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 ==. Read more

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

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.