pub trait MiraArray: Any {
// Required methods
fn len(&self) -> usize;
fn get(
&self,
self_handle: MiraHandle<dyn MiraArray>,
runtime: &Runtime,
index: usize,
) -> Result<MiraManageable, Box<MiraError>>;
// Provided methods
fn iter<'a>(
&'a self,
self_handle: MiraHandle<dyn MiraArray>,
runtime: &'a Runtime,
) -> Option<Box<dyn ExactSizeIterator<Item = Result<MiraArrayEntry, Box<MiraError>>> + 'a>> { ... }
fn is_empty(&self) -> bool { ... }
}Expand description
A read-only MiraScript array view.
Required Methods§
Sourcefn get(
&self,
self_handle: MiraHandle<dyn MiraArray>,
runtime: &Runtime,
index: usize,
) -> Result<MiraManageable, Box<MiraError>>
fn get( &self, self_handle: MiraHandle<dyn MiraArray>, runtime: &Runtime, index: usize, ) -> Result<MiraManageable, Box<MiraError>>
Read one element by index.
Provided Methods§
Sourcefn iter<'a>(
&'a self,
self_handle: MiraHandle<dyn MiraArray>,
runtime: &'a Runtime,
) -> Option<Box<dyn ExactSizeIterator<Item = Result<MiraArrayEntry, Box<MiraError>>> + 'a>>
fn iter<'a>( &'a self, self_handle: MiraHandle<dyn MiraArray>, runtime: &'a Runtime, ) -> Option<Box<dyn ExactSizeIterator<Item = Result<MiraArrayEntry, Box<MiraError>>> + 'a>>
Return a more efficient sequential iterator when indexed reads are unsuitable.
The default None keeps full materialization on MiraArray::get. Implementations
backed by containers without constant-time indexed access can return an iterator to
avoid repeatedly traversing from the beginning.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".