[][src]Trait heaparray::impls::SafeArrayPtr

pub unsafe trait SafeArrayPtr<E, L>: BaseArrayPtr<E, L> {
    fn set_len(&mut self, len: usize);
fn get_len(&self) -> usize; }

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 of array.get_len(), and after calling array.set_len(len), array.get_len() will return the value that was set
  • Any pointer returned by array.get_ptr(i) or array.get_ptr_mut() where i < len points to aligned, allocated memory
  • both array.get_label() and array.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

Loading content...

Implementors

Loading content...