[−][src]Struct toml_edit::Array
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]
&mut self,
index: usize,
v: V
) -> Result<(), Value>
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]
&mut self,
index: usize,
v: V
) -> Result<Value, Value>
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]
&mut self,
index: usize,
v: Value
) -> Result<Value, Value>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,