pub struct DataArray {
pub data_ref: usize,
}Expand description
Represents an array of type ndata.Data.
Fields
data_ref: usizeThe pointer to the array in the array heap.
Implementations
sourceimpl DataArray
impl DataArray
sourcepub fn init() -> ((usize, usize), (usize, usize))
pub fn init() -> ((usize, usize), (usize, usize))
Initialize global storage of arrays. Call only once at startup.
sourcepub fn mirror(q: (usize, usize), r: (usize, usize))
pub fn mirror(q: (usize, usize), r: (usize, usize))
Mirror global storage of arrays from another process. Call only once at startup.
sourcepub fn from_string(s: &str) -> DataArray
pub fn from_string(s: &str) -> DataArray
Create a new DataArray from a JSON string.
sourcepub fn duplicate(&self) -> DataArray
pub fn duplicate(&self) -> DataArray
Returns a new DataArray that points to the same underlying array instance.
sourcepub fn shallow_copy(self) -> DataArray
pub fn shallow_copy(self) -> DataArray
Returns a new DataArray that points to a new array instance, which contains the
same underlying data as the original.
sourcepub fn deep_copy(&self) -> DataArray
pub fn deep_copy(&self) -> DataArray
Returns a new DataArray that points to a new array instance, which contains a
recursively deep copy of the original underlying data.
sourcepub fn get_property(&self, id: usize) -> Data
pub fn get_property(&self, id: usize) -> Data
Returns the indexed value from the array
sourcepub fn get_string(&self, id: usize) -> String
pub fn get_string(&self, id: usize) -> String
Returns the indexed value from the array as a String
sourcepub fn get_array(&self, id: usize) -> DataArray
pub fn get_array(&self, id: usize) -> DataArray
Returns the indexed value from the array as a DataArray
sourcepub fn get_object(&self, id: usize) -> DataObject
pub fn get_object(&self, id: usize) -> DataObject
Returns the indexed value from the array as a DataObject
sourcepub fn get_bytes(&self, id: usize) -> DataBytes
pub fn get_bytes(&self, id: usize) -> DataBytes
Returns the indexed value from the array as a DataBytes
sourcepub fn push_property(&mut self, data: Data)
pub fn push_property(&mut self, data: Data)
Append the given value to the end of the array
sourcepub fn push_float(&mut self, val: f64)
pub fn push_float(&mut self, val: f64)
Append the given f64 to the end of the array
sourcepub fn push_object(&mut self, o: DataObject)
pub fn push_object(&mut self, o: DataObject)
Append the given DataObject to the end of the array
pub fn push_list(&mut self, a: DataArray)
push_array insteadsourcepub fn push_array(&mut self, a: DataArray)
pub fn push_array(&mut self, a: DataArray)
Append the given DataArray to the end of the array
sourcepub fn push_bytes(&mut self, a: DataBytes)
pub fn push_bytes(&mut self, a: DataBytes)
Append the given DataBytes to the end of the array
sourcepub fn remove_property(&mut self, id: usize)
pub fn remove_property(&mut self, id: usize)
Remove the indexed value from the array
sourcepub fn delete(
aheap: &mut Heap<Vec<Data>>,
data_ref: usize,
oheap: &mut Heap<HashMap<String, Data>>
)
pub fn delete(
aheap: &mut Heap<Vec<Data>>,
data_ref: usize,
oheap: &mut Heap<HashMap<String, Data>>
)
DO NOT USE
Reduces the reference count for this array by one, as well as the reference counts of any
objects, arrays, or byte buffers contained in this array. This function should only be used
externally by DataObject::gc().
sourcepub fn print_heap()
pub fn print_heap()
Prints the arrays currently stored in the heap