[−][src]Trait heaparray::impls::SafeArrayPtr
Array pointer that also knows what its length is.
In addition to the invariants discussed in
BaseArrayPtr
, implementors of this trait need
to maintain the following for any instance created via
let array = Self::alloc(len)
:
- The method
array.set_len(len)
, and only that method, can change the result ofarray.get_len()
, and after callingarray.set_len(len)
,array.get_len()
will return the value that was set - Any pointer returned by
array.get_ptr(i)
orarray.get_ptr_mut()
wherei < len
points to aligned, allocated memory - both
array.get_label()
andarray.get_label_mut()
point to allocated, aligned memory as well.
Required methods
fn set_len(&mut self, len: usize)
Set the length of this array
fn get_len(&self) -> usize
Get the length of this array