Enum toml_edit::Value

source ·
pub enum Value {
    String(Formatted<String>),
    Integer(Formatted<i64>),
    Float(Formatted<f64>),
    Boolean(Formatted<bool>),
    Datetime(Formatted<Datetime>),
    Array(Array),
    InlineTable(InlineTable),
}
Expand description

Representation of a TOML Value (as part of a Key/Value Pair).

Variants§

§

String(Formatted<String>)

A string value.

§

Integer(Formatted<i64>)

A 64-bit integer value.

§

Float(Formatted<f64>)

A 64-bit float value.

§

Boolean(Formatted<bool>)

A boolean value.

§

Datetime(Formatted<Datetime>)

An RFC 3339 formatted date-time with offset.

§

Array(Array)

An inline array of values.

§

InlineTable(InlineTable)

An inline table of key/value pairs.

Implementations§

Downcasting

Text description of value type

Casts self to str.

Returns true iff self is a string.

Casts self to integer.

Returns true iff self is an integer.

Casts self to float.

Returns true iff self is a float.

Casts self to boolean.

Returns true iff self is a boolean.

Casts self to date-time.

Returns true iff self is a date-time.

Casts self to array.

Casts self to mutable array.

Returns true iff self is an array.

Casts self to inline table.

Casts self to mutable inline table.

Returns true iff self is an inline table.

Get the decoration of the value.

Example
let v = toml_edit::Value::from(true);
assert_eq!(v.decor().suffix(), None);

Get the decoration of the value.

Example
let v = toml_edit::Value::from(true);
assert_eq!(v.decor().suffix(), None);

Sets the prefix and the suffix for value.

Example
let mut v = toml_edit::Value::from(42);
assert_eq!(&v.to_string(), "42");
let d = v.decorated(" ", " ");
assert_eq!(&d.to_string(), " 42 ");

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
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more

Parses a value from a &str

The associated error which can be returned from parsing.
The type of the deserializer being converted into.
Convert this value into a deserializer.

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
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. 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.