Struct Separated Copy item path Source pub struct Separated<const SEP: char = ',', A = Same >();Expand description A sequence that is written as text with a separator, like a,b,c.
This is for lists in places where only text fits, like environment
variables and command line arguments. When deserializing, a string (or
a lexical atom ) is split at the separator SEP (a comma
by default) and every piece is deserialized with the adapter A (by
default Same ) as a lexical atom, so numbers and booleans parse. The
empty string is an empty sequence. Sequences are accepted as they are
(their elements are not split), so the same type still reads arrays from
JSON or TOML. Pieces are not trimmed and there is no escaping, see
TrimWhitespace to trim them.
When serializing, the elements are joined with the separator into a
string in all formats. Elements have to be strings, numbers, booleans
or chars. Values that would not read back are an error: an element that
contains the separator and a sequence of a single empty string (which
would read back as the empty sequence).
Supported are Vec<T>, VecDeque<T>, BTreeSet<T> and HashSet<T>.
use deser::adapters::{Separated, TrimWhitespace};
use deser::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Config {
#[deser(as = Separated)]
hosts: Vec<String>,
#[deser(as = Separated<':' >)]
search_path: Vec<String>,
#[deser(as = Separated<',' , TrimWhitespace>)]
ports: Vec<u16>,
}Creates a sink that deserializes the value into the given slot.
Read more Returns what the value expects, for error messages.
Read more Deserializes an atom into the slot.
Read more Deserializes an atom that borrows from the data being deserialized
into the slot.
Read more Describes the Rust shape of the type.
Read more Provides the value of a missing struct field.
Read more Creates a sink that updates an existing value.
Read more Creates a sink that deserializes the value into the given slot.
Read more Returns what the value expects, for error messages.
Read more Deserializes an atom into the slot.
Read more Deserializes an atom that borrows from the data being deserialized
into the slot.
Read more Describes the Rust shape of the type.
Read more Provides the value of a missing struct field.
Read more Creates a sink that updates an existing value.
Read more Creates a sink that deserializes the value into the given slot.
Read more Returns what the value expects, for error messages.
Read more Deserializes an atom into the slot.
Read more Deserializes an atom that borrows from the data being deserialized
into the slot.
Read more Describes the Rust shape of the type.
Read more Provides the value of a missing struct field.
Read more Creates a sink that updates an existing value.
Read more Creates a sink that deserializes the value into the given slot.
Read more Returns what the value expects, for error messages.
Read more Deserializes an atom into the slot.
Read more Deserializes an atom that borrows from the data being deserialized
into the slot.
Read more Describes the Rust shape of the type.
Read more Provides the value of a missing struct field.
Read more Creates a sink that updates an existing value.
Read more Serializes the value.
Invoked after the serialization finished.
Read more Checks if the value represents an optional value.
Read more Describes the Rust shape of the value.
Read more Returns the shape of the value if it’s a map or sequence.
Read more Serializes the value.
Invoked after the serialization finished.
Read more Checks if the value represents an optional value.
Read more Describes the Rust shape of the value.
Read more Returns the shape of the value if it’s a map or sequence.
Read more Serializes the value.
Invoked after the serialization finished.
Read more Checks if the value represents an optional value.
Read more Describes the Rust shape of the value.
Read more Returns the shape of the value if it’s a map or sequence.
Read more Serializes the value.
Invoked after the serialization finished.
Read more Checks if the value represents an optional value.
Read more Describes the Rust shape of the value.
Read more Returns the shape of the value if it’s a map or sequence.
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 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.