pub struct Array {
    pub values: Vec<Value>,
}Expand description
Represents an array of Values.
Fields§
§values: Vec<Value>Implementations§
Source§impl Array
 
impl Array
Sourcepub fn new() -> Array
 
pub fn new() -> Array
Creates a new empty Array.
§Examples
use my_crate::Array;
let empty_array = Array::new();
assert_eq!(empty_array.len(), 0);Sourcepub fn get(&self, index: usize) -> Option<&Value>
 
pub fn get(&self, index: usize) -> Option<&Value>
Returns a reference to the value at the specified index, or None if the index is out of bounds.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut Value>
 
pub fn get_mut(&mut self, index: usize) -> Option<&mut Value>
Returns a mutable reference to the value at the specified index, or None if the index is out of bounds.
pub fn clean(&mut self)
Sourcepub fn push(&mut self, value: Value)
 
pub fn push(&mut self, value: Value)
Appends a value to the end of the array.
§Examples
use my_crate::{Array, Value};
let mut array = Array::new();
array.push(Value::from(42));
array.push(Value::from("hello"));
assert_eq!(array.len(), 2);
assert_eq!(array.get(0), Some(&Value::from(42)));
assert_eq!(array.get(1), Some(&Value::from("hello")));pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl ArrayBehavior for Array
 
impl ArrayBehavior for Array
Source§impl<'a> IntoIterator for &'a Array
 
impl<'a> IntoIterator for &'a Array
Source§impl<'a> IntoIterator for &'a mut Array
 
impl<'a> IntoIterator for &'a mut Array
Source§impl IntoIterator for Array
 
impl IntoIterator for Array
Source§impl PartialOrd for Array
 
impl PartialOrd for Array
Source§impl ToValueBehavior for Array
 
impl ToValueBehavior for Array
impl PrimitiveType for Array
impl StructuralPartialEq for Array
Auto Trait Implementations§
impl Freeze for Array
impl RefUnwindSafe for Array
impl Send for Array
impl Sync for Array
impl Unpin for Array
impl UnwindSafe for Array
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> FutureExt for T
 
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
 
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
 
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
 
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
 
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
 
fn into_request(self) -> Request<T>
Wrap the input message 
T in a tonic::RequestSource§impl<T> Pointable for T
 
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.