[−][src]Struct ijson::array::IArray
The IArray
type is similar to a Vec<IValue>
. The primary difference is
that the length and capacity are stored inside the heap allocation, so that
the IArray
itself can be a single pointer.
Implementations
impl IArray
[src]
pub fn new() -> Self
[src]
Constructs a new empty IArray
. Does not allocate.
pub fn with_capacity(cap: usize) -> Self
[src]
Constructs a new IArray
with the specified capacity. At least that many items
can be added to the array without reallocating.
pub fn capacity(&self) -> usize
[src]
Returns the capacity of the array. This is the maximum number of items the array can hold without reallocating.
pub fn len(&self) -> usize
[src]
Returns the number of items currently stored in the array.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the array is empty.
pub fn as_slice(&self) -> &[IValue]
[src]
Borrows a slice of IValue
s from the array
pub fn as_mut_slice(&mut self) -> &mut [IValue]
[src]
Borrows a mutable slice of IValue
s from the array
pub fn reserve(&mut self, additional: usize)
[src]
Reserves space for at least this many additional items.
pub fn truncate(&mut self, len: usize)
[src]
Truncates the array by removing items until it is no longer than the specified length. The capacity is unchanged.
pub fn clear(&mut self)
[src]
Removes all items from the array. The capacity is unchanged.
pub fn insert(&mut self, index: usize, item: impl Into<IValue>)
[src]
Inserts a new item into the array at the specified index. Any existing items on or after this index will be shifted down to accomodate this. For large arrays, insertions near the front will be slow as it will require shifting a large number of items.
pub fn remove(&mut self, index: usize) -> Option<IValue>
[src]
Removes and returns the item at the specified index from the array. Any items after this index will be shifted back up to close the gap. For large arrays, removals from near the front will be slow as it will require shifting a large number of items.
If the order of the array is unimporant, consider using IArray::swap_remove
.
If the index is outside the array bounds, None
is returned.
pub fn swap_remove(&mut self, index: usize) -> Option<IValue>
[src]
Removes and returns the item at the specified index from the array by first swapping it with the item currently at the end of the array, and then popping that last item.
This can be more efficient than IArray::remove
for large arrays,
but will change the ordering of items within the array.
If the index is outside the array bounds, None
is returned.
pub fn push(&mut self, item: impl Into<IValue>)
[src]
Pushes a new item onto the back of the array.
pub fn pop(&mut self) -> Option<IValue>
[src]
Pops the last item from the array and returns it. If the array is
empty, None
is returned.
pub fn shrink_to_fit(&mut self)
[src]
Shrinks the memory allocation used by the array such that its capacity becomes equal to its length.
Trait Implementations
impl AsMut<IValue> for IArray
[src]
impl AsRef<[IValue]> for IArray
[src]
impl AsRef<IValue> for IArray
[src]
impl Borrow<[IValue]> for IArray
[src]
impl Borrow<IValue> for IArray
[src]
impl BorrowMut<[IValue]> for IArray
[src]
pub fn borrow_mut(&mut self) -> &mut [IValue]
[src]
impl BorrowMut<IValue> for IArray
[src]
pub fn borrow_mut(&mut self) -> &mut IValue
[src]
impl Clone for IArray
[src]
impl Debug for IArray
[src]
impl Default for IArray
[src]
impl Deref for IArray
[src]
type Target = [IValue]
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl DerefMut for IArray
[src]
impl<'de> Deserialize<'de> for IArray
[src]
pub fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl<'de> Deserializer<'de> for &'de IArray
[src]
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
pub fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
[src]
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
pub fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_byte_buf<V>(
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
V: Visitor<'de>,
pub fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_enum<V>(
self,
name: &'static str,
variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
name: &'static str,
variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_identifier<V>(
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn deserialize_ignored_any<V>(
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
[src]
self,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
pub fn is_human_readable(&self) -> bool
[src]
impl Eq for IArray
[src]
impl<U: Into<IValue>> Extend<U> for IArray
[src]
pub fn extend<T: IntoIterator<Item = U>>(&mut self, iter: T)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Into<IValue> + Clone, '_> From<&'_ [T]> for IArray
[src]
impl From<IArray> for IValue
[src]
impl<T: Into<IValue>> From<Vec<T>> for IArray
[src]
impl<U: Into<IValue>> FromIterator<U> for IArray
[src]
pub fn from_iter<T: IntoIterator<Item = U>>(iter: T) -> Self
[src]
impl Hash for IArray
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<I: SliceIndex<[IValue]>> Index<I> for IArray
[src]
type Output = I::Output
The returned type after indexing.
pub fn index(&self, index: I) -> &Self::Output
[src]
impl<I: SliceIndex<[IValue]>> IndexMut<I> for IArray
[src]
impl IntoIterator for IArray
[src]
type Item = IValue
The type of the elements being iterated over.
type IntoIter = IntoIter
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a IArray
[src]
type Item = &'a IValue
The type of the elements being iterated over.
type IntoIter = Iter<'a, IValue>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl<'a> IntoIterator for &'a mut IArray
[src]
type Item = &'a mut IValue
The type of the elements being iterated over.
type IntoIter = IterMut<'a, IValue>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<IArray> for IArray
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<IArray> for IArray
[src]
pub fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for IArray
[src]
impl<'a> TryFrom<&'a IValue> for &'a IArray
[src]
type Error = ()
The type returned in the event of a conversion error.
pub fn try_from(other: &'a IValue) -> Result<Self, ()>
[src]
impl<'a> TryFrom<&'a mut IValue> for &'a mut IArray
[src]
type Error = ()
The type returned in the event of a conversion error.
pub fn try_from(other: &'a mut IValue) -> Result<Self, ()>
[src]
impl TryFrom<IValue> for IArray
[src]
Auto Trait Implementations
impl RefUnwindSafe for IArray
impl Send for IArray
impl Sync for IArray
impl Unpin for IArray
impl UnwindSafe for IArray
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,