Struct toml_edit::Array

source ·
pub struct Array { /* private fields */ }
Expand description

Type representing a TOML array, payload of the Value::Array variant’s value

Implementations§

Constructors

See also FromIterator

Create an empty Array

Examples
let mut arr = toml_edit::Array::new();

Formatting

Auto formats the array.

Examples found in repository?
src/array_of_tables.rs (line 30)
25
26
27
28
29
30
31
32
    pub fn into_array(mut self) -> Array {
        for value in self.values.iter_mut() {
            value.make_value();
        }
        let mut a = Array::with_vec(self.values);
        a.fmt();
        a
    }

Set whether the array will use a trailing comma

Examples found in repository?
src/ser/pretty.rs (line 36)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    fn visit_array_mut(&mut self, node: &mut crate::Array) {
        crate::visit_mut::visit_array_mut(self, node);

        if (0..=1).contains(&node.len()) {
            node.set_trailing("");
            node.set_trailing_comma(false);
        } else {
            for item in node.iter_mut() {
                item.decor_mut().set_prefix("\n    ");
            }
            node.set_trailing("\n");
            node.set_trailing_comma(true);
        }
    }
More examples
Hide additional examples
src/array.rs (line 372)
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
fn decorate_array(array: &mut Array) {
    for (i, value) in array
        .values
        .iter_mut()
        .filter_map(Item::as_value_mut)
        .enumerate()
    {
        // [value1, value2, value3]
        if i == 0 {
            value.decorate(DEFAULT_LEADING_VALUE_DECOR.0, DEFAULT_LEADING_VALUE_DECOR.1);
        } else {
            value.decorate(DEFAULT_VALUE_DECOR.0, DEFAULT_VALUE_DECOR.1);
        }
    }
    // Since everything is now on the same line, remove trailing commas and whitespace.
    array.set_trailing_comma(false);
    array.set_trailing("");
}
src/parser/array.rs (line 54)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pub(crate) fn array_values(input: Input<'_>) -> IResult<Input<'_>, Array, ParserError<'_>> {
    (
        opt(
            (separated_list1(ARRAY_SEP, array_value), opt(ARRAY_SEP)).map(
                |(v, trailing): (Vec<Value>, Option<u8>)| {
                    (
                        Array::with_vec(v.into_iter().map(Item::Value).collect()),
                        trailing.is_some(),
                    )
                },
            ),
        ),
        ws_comment_newline,
    )
        .map_res::<_, _, std::str::Utf8Error>(|(array, trailing)| {
            let (mut array, comma) = array.unwrap_or_default();
            array.set_trailing_comma(comma);
            array.set_trailing(std::str::from_utf8(trailing)?);
            Ok(array)
        })
        .parse(input)
}

Whether the array will use a trailing comma

Examples found in repository?
src/encode.rs (line 88)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    fn encode(&self, buf: &mut dyn Write, default_decor: (&str, &str)) -> Result {
        write!(buf, "{}[", self.decor().prefix().unwrap_or(default_decor.0))?;

        for (i, elem) in self.iter().enumerate() {
            let inner_decor;
            if i == 0 {
                inner_decor = DEFAULT_LEADING_VALUE_DECOR;
            } else {
                inner_decor = DEFAULT_VALUE_DECOR;
                write!(buf, ",")?;
            }
            elem.encode(buf, inner_decor)?;
        }
        if self.trailing_comma() && !self.is_empty() {
            write!(buf, ",")?;
        }

        write!(buf, "{}", self.trailing())?;
        write!(buf, "]{}", self.decor().suffix().unwrap_or(default_decor.1))
    }

Set whitespace after last element

Examples found in repository?
src/ser/pretty.rs (line 35)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    fn visit_array_mut(&mut self, node: &mut crate::Array) {
        crate::visit_mut::visit_array_mut(self, node);

        if (0..=1).contains(&node.len()) {
            node.set_trailing("");
            node.set_trailing_comma(false);
        } else {
            for item in node.iter_mut() {
                item.decor_mut().set_prefix("\n    ");
            }
            node.set_trailing("\n");
            node.set_trailing_comma(true);
        }
    }
More examples
Hide additional examples
src/array.rs (line 373)
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
fn decorate_array(array: &mut Array) {
    for (i, value) in array
        .values
        .iter_mut()
        .filter_map(Item::as_value_mut)
        .enumerate()
    {
        // [value1, value2, value3]
        if i == 0 {
            value.decorate(DEFAULT_LEADING_VALUE_DECOR.0, DEFAULT_LEADING_VALUE_DECOR.1);
        } else {
            value.decorate(DEFAULT_VALUE_DECOR.0, DEFAULT_VALUE_DECOR.1);
        }
    }
    // Since everything is now on the same line, remove trailing commas and whitespace.
    array.set_trailing_comma(false);
    array.set_trailing("");
}
src/parser/array.rs (line 55)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pub(crate) fn array_values(input: Input<'_>) -> IResult<Input<'_>, Array, ParserError<'_>> {
    (
        opt(
            (separated_list1(ARRAY_SEP, array_value), opt(ARRAY_SEP)).map(
                |(v, trailing): (Vec<Value>, Option<u8>)| {
                    (
                        Array::with_vec(v.into_iter().map(Item::Value).collect()),
                        trailing.is_some(),
                    )
                },
            ),
        ),
        ws_comment_newline,
    )
        .map_res::<_, _, std::str::Utf8Error>(|(array, trailing)| {
            let (mut array, comma) = array.unwrap_or_default();
            array.set_trailing_comma(comma);
            array.set_trailing(std::str::from_utf8(trailing)?);
            Ok(array)
        })
        .parse(input)
}

Whitespace after last element

Examples found in repository?
src/encode.rs (line 92)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    fn encode(&self, buf: &mut dyn Write, default_decor: (&str, &str)) -> Result {
        write!(buf, "{}[", self.decor().prefix().unwrap_or(default_decor.0))?;

        for (i, elem) in self.iter().enumerate() {
            let inner_decor;
            if i == 0 {
                inner_decor = DEFAULT_LEADING_VALUE_DECOR;
            } else {
                inner_decor = DEFAULT_VALUE_DECOR;
                write!(buf, ",")?;
            }
            elem.encode(buf, inner_decor)?;
        }
        if self.trailing_comma() && !self.is_empty() {
            write!(buf, ",")?;
        }

        write!(buf, "{}", self.trailing())?;
        write!(buf, "]{}", self.decor().suffix().unwrap_or(default_decor.1))
    }

Returns the surrounding whitespace

Examples found in repository?
src/value.rs (line 167)
160
161
162
163
164
165
166
167
168
169
170
    pub fn decor_mut(&mut self) -> &mut Decor {
        match self {
            Value::String(f) => f.decor_mut(),
            Value::Integer(f) => f.decor_mut(),
            Value::Float(f) => f.decor_mut(),
            Value::Boolean(f) => f.decor_mut(),
            Value::Datetime(f) => f.decor_mut(),
            Value::Array(a) => a.decor_mut(),
            Value::InlineTable(t) => t.decor_mut(),
        }
    }

Returns the surrounding whitespace

Examples found in repository?
src/value.rs (line 185)
178
179
180
181
182
183
184
185
186
187
188
    pub fn decor(&self) -> &Decor {
        match *self {
            Value::String(ref f) => f.decor(),
            Value::Integer(ref f) => f.decor(),
            Value::Float(ref f) => f.decor(),
            Value::Boolean(ref f) => f.decor(),
            Value::Datetime(ref f) => f.decor(),
            Value::Array(ref a) => a.decor(),
            Value::InlineTable(ref t) => t.decor(),
        }
    }
More examples
Hide additional examples
src/encode.rs (line 76)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    fn encode(&self, buf: &mut dyn Write, default_decor: (&str, &str)) -> Result {
        write!(buf, "{}[", self.decor().prefix().unwrap_or(default_decor.0))?;

        for (i, elem) in self.iter().enumerate() {
            let inner_decor;
            if i == 0 {
                inner_decor = DEFAULT_LEADING_VALUE_DECOR;
            } else {
                inner_decor = DEFAULT_VALUE_DECOR;
                write!(buf, ",")?;
            }
            elem.encode(buf, inner_decor)?;
        }
        if self.trailing_comma() && !self.is_empty() {
            write!(buf, ",")?;
        }

        write!(buf, "{}", self.trailing())?;
        write!(buf, "]{}", self.decor().suffix().unwrap_or(default_decor.1))
    }

Returns an iterator over all values.

Examples found in repository?
src/array.rs (line 353)
352
353
354
    fn into_iter(self) -> Self::IntoIter {
        self.iter()
    }
More examples
Hide additional examples
src/visit.rs (line 193)
189
190
191
192
193
194
195
196
pub fn visit_array<'doc, V>(v: &mut V, node: &'doc Array)
where
    V: Visit<'doc> + ?Sized,
{
    for value in node.iter() {
        v.visit_value(value);
    }
}
src/encode.rs (line 78)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    fn encode(&self, buf: &mut dyn Write, default_decor: (&str, &str)) -> Result {
        write!(buf, "{}[", self.decor().prefix().unwrap_or(default_decor.0))?;

        for (i, elem) in self.iter().enumerate() {
            let inner_decor;
            if i == 0 {
                inner_decor = DEFAULT_LEADING_VALUE_DECOR;
            } else {
                inner_decor = DEFAULT_VALUE_DECOR;
                write!(buf, ",")?;
            }
            elem.encode(buf, inner_decor)?;
        }
        if self.trailing_comma() && !self.is_empty() {
            write!(buf, ",")?;
        }

        write!(buf, "{}", self.trailing())?;
        write!(buf, "]{}", self.decor().suffix().unwrap_or(default_decor.1))
    }
src/item.rs (line 152)
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    pub fn into_array_of_tables(self) -> Result<ArrayOfTables, Self> {
        match self {
            Item::ArrayOfTables(a) => Ok(a),
            Item::Value(Value::Array(a)) => {
                if a.is_empty() {
                    Err(Item::Value(Value::Array(a)))
                } else if a.iter().all(|v| v.is_inline_table()) {
                    let mut aot = ArrayOfTables::new();
                    aot.values = a.values;
                    for value in aot.values.iter_mut() {
                        value.make_item();
                    }
                    Ok(aot)
                } else {
                    Err(Item::Value(Value::Array(a)))
                }
            }
            _ => Err(self),
        }
    }

Returns an iterator over all values.

Examples found in repository?
src/visit_mut.rs (line 209)
205
206
207
208
209
210
211
212
pub fn visit_array_mut<V>(v: &mut V, node: &mut Array)
where
    V: VisitMut + ?Sized,
{
    for value in node.iter_mut() {
        v.visit_value_mut(value);
    }
}
More examples
Hide additional examples
src/ser/pretty.rs (line 38)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    fn visit_array_mut(&mut self, node: &mut crate::Array) {
        crate::visit_mut::visit_array_mut(self, node);

        if (0..=1).contains(&node.len()) {
            node.set_trailing("");
            node.set_trailing_comma(false);
        } else {
            for item in node.iter_mut() {
                item.decor_mut().set_prefix("\n    ");
            }
            node.set_trailing("\n");
            node.set_trailing_comma(true);
        }
    }

Returns the length of the underlying Vec.

In some rare cases, placeholder elements will exist. For a more accurate count, call a.iter().count()

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");
assert_eq!(arr.len(), 2);
Examples found in repository?
src/array.rs (line 131)
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
    pub fn is_empty(&self) -> bool {
        self.len() == 0
    }

    /// Clears the array, removing all values. Keeps the allocated memory for reuse.
    pub fn clear(&mut self) {
        self.values.clear()
    }

    /// Returns a reference to the value at the given index, or `None` if the index is out of
    /// bounds.
    pub fn get(&self, index: usize) -> Option<&Value> {
        self.values.get(index).and_then(Item::as_value)
    }

    /// Returns a reference to the value at the given index, or `None` if the index is out of
    /// bounds.
    pub fn get_mut(&mut self, index: usize) -> Option<&mut Value> {
        self.values.get_mut(index).and_then(Item::as_value_mut)
    }

    /// Appends a new value to the end of the array, applying default formatting to it.
    ///
    /// # Examples
    ///
    /// ```rust
    /// let mut arr = toml_edit::Array::new();
    /// arr.push(1);
    /// arr.push("foo");
    /// ```
    pub fn push<V: Into<Value>>(&mut self, v: V) {
        self.value_op(v.into(), true, |items, value| {
            items.push(Item::Value(value))
        })
    }

    /// Appends a new, already formatted value to the end of the array.
    ///
    /// # Examples
    ///
    /// ```rust
    /// let formatted_value = "'literal'".parse::<toml_edit::Value>().unwrap();
    /// let mut arr = toml_edit::Array::new();
    /// arr.push_formatted(formatted_value);
    /// ```
    pub fn push_formatted(&mut self, v: Value) {
        self.values.push(Item::Value(v));
    }

    /// Inserts an element at the given position within the array, applying default formatting to
    /// it and shifting all values after it to the right.
    ///
    /// # Panics
    ///
    /// Panics if `index > len`.
    ///
    /// # Examples
    ///
    /// ```rust
    /// let mut arr = toml_edit::Array::new();
    /// arr.push(1);
    /// arr.push("foo");
    ///
    /// arr.insert(0, "start");
    /// ```
    pub fn insert<V: Into<Value>>(&mut self, index: usize, v: V) {
        self.value_op(v.into(), true, |items, value| {
            items.insert(index, Item::Value(value))
        })
    }

    /// Inserts an already formatted value at the given position within the array, shifting all
    /// values after it to the right.
    ///
    /// # Panics
    ///
    /// Panics if `index > len`.
    ///
    /// # Examples
    ///
    /// ```rust
    /// let mut arr = toml_edit::Array::new();
    /// arr.push(1);
    /// arr.push("foo");
    ///
    /// let formatted_value = "'start'".parse::<toml_edit::Value>().unwrap();
    /// arr.insert_formatted(0, formatted_value);
    /// ```
    pub fn insert_formatted(&mut self, index: usize, v: Value) {
        self.values.insert(index, Item::Value(v))
    }

    /// Replaces the element at the given position within the array, preserving existing formatting.
    ///
    /// # Panics
    ///
    /// Panics if `index >= len`.
    ///
    /// # Examples
    ///
    /// ```rust
    /// let mut arr = toml_edit::Array::new();
    /// arr.push(1);
    /// arr.push("foo");
    ///
    /// arr.replace(0, "start");
    /// ```
    pub fn replace<V: Into<Value>>(&mut self, index: usize, v: V) -> Value {
        // Read the existing value's decor and preserve it.
        let existing_decor = self
            .get(index)
            .unwrap_or_else(|| panic!("index {} out of bounds (len = {})", index, self.len()))
            .decor();
        let mut value = v.into();
        *value.decor_mut() = existing_decor.clone();
        self.replace_formatted(index, value)
    }
More examples
Hide additional examples
src/ser/pretty.rs (line 34)
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    fn visit_array_mut(&mut self, node: &mut crate::Array) {
        crate::visit_mut::visit_array_mut(self, node);

        if (0..=1).contains(&node.len()) {
            node.set_trailing("");
            node.set_trailing_comma(false);
        } else {
            for item in node.iter_mut() {
                item.decor_mut().set_prefix("\n    ");
            }
            node.set_trailing("\n");
            node.set_trailing_comma(true);
        }
    }

Return true iff self.len() == 0.

Examples
let mut arr = toml_edit::Array::new();
assert!(arr.is_empty());

arr.push(1);
arr.push("foo");
assert!(! arr.is_empty());
Examples found in repository?
src/array.rs (line 298)
291
292
293
294
295
296
297
298
299
300
301
302
303
304
    fn value_op<T>(
        &mut self,
        v: Value,
        decorate: bool,
        op: impl FnOnce(&mut Vec<Item>, Value) -> T,
    ) -> T {
        let mut value = v;
        if !self.is_empty() && decorate {
            value.decorate(" ", "");
        } else if decorate {
            value.decorate("", "");
        }
        op(&mut self.values, value)
    }
More examples
Hide additional examples
src/encode.rs (line 88)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    fn encode(&self, buf: &mut dyn Write, default_decor: (&str, &str)) -> Result {
        write!(buf, "{}[", self.decor().prefix().unwrap_or(default_decor.0))?;

        for (i, elem) in self.iter().enumerate() {
            let inner_decor;
            if i == 0 {
                inner_decor = DEFAULT_LEADING_VALUE_DECOR;
            } else {
                inner_decor = DEFAULT_VALUE_DECOR;
                write!(buf, ",")?;
            }
            elem.encode(buf, inner_decor)?;
        }
        if self.trailing_comma() && !self.is_empty() {
            write!(buf, ",")?;
        }

        write!(buf, "{}", self.trailing())?;
        write!(buf, "]{}", self.decor().suffix().unwrap_or(default_decor.1))
    }
src/item.rs (line 150)
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
    pub fn into_array_of_tables(self) -> Result<ArrayOfTables, Self> {
        match self {
            Item::ArrayOfTables(a) => Ok(a),
            Item::Value(Value::Array(a)) => {
                if a.is_empty() {
                    Err(Item::Value(Value::Array(a)))
                } else if a.iter().all(|v| v.is_inline_table()) {
                    let mut aot = ArrayOfTables::new();
                    aot.values = a.values;
                    for value in aot.values.iter_mut() {
                        value.make_item();
                    }
                    Ok(aot)
                } else {
                    Err(Item::Value(Value::Array(a)))
                }
            }
            _ => Err(self),
        }
    }

Clears the array, removing all values. Keeps the allocated memory for reuse.

Returns a reference to the value at the given index, or None if the index is out of bounds.

Examples found in repository?
src/array.rs (line 240)
237
238
239
240
241
242
243
244
245
246
    pub fn replace<V: Into<Value>>(&mut self, index: usize, v: V) -> Value {
        // Read the existing value's decor and preserve it.
        let existing_decor = self
            .get(index)
            .unwrap_or_else(|| panic!("index {} out of bounds (len = {})", index, self.len()))
            .decor();
        let mut value = v.into();
        *value.decor_mut() = existing_decor.clone();
        self.replace_formatted(index, value)
    }

Returns a reference to the value at the given index, or None if the index is out of bounds.

Appends a new value to the end of the array, applying default formatting to it.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

Appends a new, already formatted value to the end of the array.

Examples
let formatted_value = "'literal'".parse::<toml_edit::Value>().unwrap();
let mut arr = toml_edit::Array::new();
arr.push_formatted(formatted_value);
Examples found in repository?
src/array.rs (line 316)
314
315
316
317
318
    fn extend<T: IntoIterator<Item = V>>(&mut self, iter: T) {
        for value in iter {
            self.push_formatted(value.into());
        }
    }

Inserts an element at the given position within the array, applying default formatting to it and shifting all values after it to the right.

Panics

Panics if index > len.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

arr.insert(0, "start");

Inserts an already formatted value at the given position within the array, shifting all values after it to the right.

Panics

Panics if index > len.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

let formatted_value = "'start'".parse::<toml_edit::Value>().unwrap();
arr.insert_formatted(0, formatted_value);

Replaces the element at the given position within the array, preserving existing formatting.

Panics

Panics if index >= len.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

arr.replace(0, "start");

Replaces the element at the given position within the array with an already formatted value.

Panics

Panics if index >= len.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

let formatted_value = "'start'".parse::<toml_edit::Value>().unwrap();
arr.replace_formatted(0, formatted_value);
Examples found in repository?
src/array.rs (line 245)
237
238
239
240
241
242
243
244
245
246
    pub fn replace<V: Into<Value>>(&mut self, index: usize, v: V) -> Value {
        // Read the existing value's decor and preserve it.
        let existing_decor = self
            .get(index)
            .unwrap_or_else(|| panic!("index {} out of bounds (len = {})", index, self.len()))
            .decor();
        let mut value = v.into();
        *value.decor_mut() = existing_decor.clone();
        self.replace_formatted(index, value)
    }

Removes the value at the given index.

Examples
let mut arr = toml_edit::Array::new();
arr.push(1);
arr.push("foo");

arr.remove(0);
assert_eq!(arr.len(), 1);

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
Returns the “default value” for a type. Read more
The error type that can be returned if some error occurs during deserialization.
Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more
Hint that the Deserialize type is expecting a bool value.
Hint that the Deserialize type is expecting a u8 value.
Hint that the Deserialize type is expecting a u16 value.
Hint that the Deserialize type is expecting a u32 value.
Hint that the Deserialize type is expecting a u64 value.
Hint that the Deserialize type is expecting an i8 value.
Hint that the Deserialize type is expecting an i16 value.
Hint that the Deserialize type is expecting an i32 value.
Hint that the Deserialize type is expecting an i64 value.
Hint that the Deserialize type is expecting a f32 value.
Hint that the Deserialize type is expecting a f64 value.
Hint that the Deserialize type is expecting a char value.
Hint that the Deserialize type is expecting a string value and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Hint that the Deserialize type is expecting a string value and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Hint that the Deserialize type is expecting a sequence of values.
Hint that the Deserialize type is expecting a byte array and does not benefit from taking ownership of buffered data owned by the Deserializer. Read more
Hint that the Deserialize type is expecting a byte array and would benefit from taking ownership of buffered data owned by the Deserializer. Read more
Hint that the Deserialize type is expecting a map of key-value pairs.
Hint that the Deserialize type is expecting an optional value. Read more
Hint that the Deserialize type is expecting a unit value.
Hint that the Deserialize type is expecting a newtype struct with a particular name.
Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more
Hint that the Deserialize type is expecting a unit struct with a particular name.
Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields.
Hint that the Deserialize type is expecting a sequence of values and knows how many values there are without looking at the serialized data.
Hint that the Deserialize type is expecting an enum value with a particular name and possible variants.
Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant.
Hint that the Deserialize type is expecting a struct with a particular name and fields.
Hint that the Deserialize type is expecting an i128 value. Read more
Hint that the Deserialize type is expecting an u128 value. Read more
Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more
Formats the value using the given formatter. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Converts to this type from the input type.
Creates a value from an iterator. Read more
The type of the deserializer being converted into.
Convert this value into a deserializer.
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
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.