Struct ini::Ini

source · []
pub struct Ini { /* private fields */ }
Expand description

Ini struct

Implementations

Create an instance

Set with a specified section, None is for the general section

Set with general section, a simple wrapper of with_section(None::<String>)

Get the immmutable general section

Get the mutable general section

Get a immutable section

Get a mutable section

Get all sections immutable with the same key

Get all sections mutable with the same key

Get the entry

Clear all entries

Iterate with sections

Set key-value to a section

Get the first value from the sections with key

Example:

use ini::Ini;
let input = "[sec]\nabc = def\n";
let ini = Ini::load_from_str(input).unwrap();
assert_eq!(ini.get_from(Some("sec"), "abc"), Some("def"));

Get the first value from the sections with key, return the default value if it does not exist

Example:

use ini::Ini;
let input = "[sec]\n";
let ini = Ini::load_from_str(input).unwrap();
assert_eq!(ini.get_from_or(Some("sec"), "key", "default"), "default");

Get the first mutable value from the sections with key

Delete the first section with key, return the properties if it exists

Delete the key from the section, return the value if key exists or None

Total sections count

Check if object coutains no section

Write to a file

Write to a file

Write to a file with options

Write to a writer

Write to a writer

Write to a writer with options

Load from a string

Load from a string, but do not interpret ’' as an escape character

Load from a string with options

Load from a reader

Load from a reader, but do not interpret ’' as an escape character

Load from a reader with options

Load from a file

Load from a file, but do not interpret ’' as an escape character

Load from a file with options

Immutable iterate though sections

👎 Deprecated:

Use iter_mut instead!

Mutable iterate though sections

Mutable iterate though sections

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. 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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.