ImmutableArray

Trait ImmutableArray 

Source
pub trait ImmutableArray<T>: Default + Index<Length> {
    // Required methods
    fn length(&self) -> Length;
    fn capacity(&self) -> Length;
    fn as_slice(&self) -> &[T];

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Represents a simply contiguous block of memory.

Required Methods§

Source

fn length(&self) -> Length

Returns array’s length as [Length].

Source

fn capacity(&self) -> Length

Returns the current capacity for holding items in the array.

Source

fn as_slice(&self) -> &[T]

Represents the array as immutable slice.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if array is empty, false otherwise. Should be consistent with self.length() == Length::ZERO check.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, TAllocator: Allocator> ImmutableArray<T> for DynamicArray<T, TAllocator>