Enum toml_edit::Value[][src]

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.

Tuple Fields of String

0: Formatted<String>
Integer(Formatted<i64>)

A 64-bit integer value.

Tuple Fields of Integer

0: Formatted<i64>
Float(Formatted<f64>)

A 64-bit float value.

Tuple Fields of Float

0: Formatted<f64>
Boolean(Formatted<bool>)

A boolean value.

Tuple Fields of Boolean

0: Formatted<bool>
Datetime(Formatted<Datetime>)

An RFC 3339 formatted date-time with offset.

Tuple Fields of Datetime

0: Formatted<Datetime>
Array(Array)

An inline array of values.

Tuple Fields of Array

0: Array
InlineTable(InlineTable)

An inline table of key/value pairs.

Tuple Fields of InlineTable

0: InlineTable

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

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.

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 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)

recently added

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.