[][src]Struct toml_edit::Array

pub struct Array { /* fields omitted */ }

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

Implementations

impl Array[src]

pub fn len(&self) -> usize[src]

Returns the length of the underlying Vec. To get the actual number of items use a.iter().count().

pub fn is_empty(&self) -> bool[src]

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

pub fn iter(&self) -> ArrayIter[src]

Returns an iterator over all values.

pub fn push<V: Into<Value>>(&mut self, v: V) -> Result<(), Value>[src]

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

Returns an error if the value was of a different type than the values in the array.

pub fn push_formatted(&mut self, v: Value) -> Result<(), Value>[src]

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

Returns an error if the value was of a different type than the array.

pub fn insert<V: Into<Value>>(
    &mut self,
    index: usize,
    v: V
) -> Result<(), Value>
[src]

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

Returns an error if the value was of a different type than the values in the array.

Panics if index > len.

pub fn insert_formatted(&mut self, index: usize, v: Value) -> Result<(), Value>[src]

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

Returns an error if the value was of a different type than the values in the array.

Panics if index > len.

pub fn replace<V: Into<Value>>(
    &mut self,
    index: usize,
    v: V
) -> Result<Value, Value>
[src]

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

Returns an error if the replacement was of a different type than the values in the array.

Panics if index >= len.

pub fn replace_formatted(
    &mut self,
    index: usize,
    v: Value
) -> Result<Value, Value>
[src]

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

Returns an error if the replacement was of a different type than the values in the array.

Panics if index >= len.

pub fn get(&self, index: usize) -> Option<&Value>[src]

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

pub fn remove(&mut self, index: usize) -> Value[src]

Removes the value at the given index.

pub fn fmt(&mut self)[src]

Auto formats the array.

Trait Implementations

impl Clone for Array[src]

impl Debug for Array[src]

impl Default for Array[src]

impl Display for Array[src]

impl From<Array> for Value[src]

Auto Trait Implementations

impl RefUnwindSafe for Array

impl Send for Array

impl Sync for Array

impl Unpin for Array

impl UnwindSafe for Array

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.