pub struct SectionMut<'a, 'event> { /* private fields */ }
Expand description

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

Implementations

Mutating methods.

Adds an entry to the end of this section name key and value.

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.

Return the newline used when calling push_newline().

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

Sets the exact whitespace to use before each newly created key-value pair, with only whitespace characters being permissible.

The default is 2 tabs. Set to None to disable adding whitespace before a key value.

Panics

If non-whitespace characters are used. This makes the method only suitable for validated or known input.

Returns the whitespace this section will insert before the beginning of a key, if any.

Returns the whitespace to be used before and after the = between the key and the value.

For example, k = v will have (Some(" "), Some(" ")), whereas k=\tv will have (None, Some("\t")).

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

Return our header.

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.

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

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

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

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

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.