Skip to main content

ImmutableArray

Trait ImmutableArray 

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

    // 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.

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 dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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

Source§

impl<T, TAllocator> ImmutableArray<T> for FixedArray<T, TAllocator>
where TAllocator: Allocator,

Source§

impl<const TCAPACITY: usize, T, TAllocator> ImmutableArray<T> for InlineDynamicArray<TCAPACITY, T, TAllocator>
where T: Sized, TAllocator: Allocator,

Source§

impl<const TSIZE: usize, T: Sized> ImmutableArray<T> for InlineFixedArray<TSIZE, T>