Trait read_fonts::traversal::SomeArray

source ·
pub trait SomeArray<'a> {
    // Required methods
    fn type_name(&self) -> &str;
    fn len(&self) -> usize;
    fn get(&self, idx: usize) -> Option<FieldType<'a>>;

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

A generic trait for arrays.

Required Methods§

source

fn type_name(&self) -> &str

The name of this type. For an array of u16s, this is [u16].

source

fn len(&self) -> usize

The length of the array.

source

fn get(&self, idx: usize) -> Option<FieldType<'a>>

Return the item at idx, or None if idx is out of bounds.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if this array is empty.

Implementations§

source§

impl<'a> dyn SomeArray<'a> + 'a

source

pub fn iter(&self) -> impl Iterator<Item = FieldType<'a>> + '_

Return an iterator over the contents of this array.

Trait Implementations§

source§

impl<'a> Debug for dyn SomeArray<'a> + 'a

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> SomeArray<'a> for Box<dyn SomeArray<'a> + 'a>

source§

fn type_name(&self) -> &str

The name of this type. For an array of u16s, this is [u16].
source§

fn len(&self) -> usize

The length of the array.
source§

fn get(&self, idx: usize) -> Option<FieldType<'a>>

Return the item at idx, or None if idx is out of bounds.
source§

fn is_empty(&self) -> bool

Returns true if this array is empty.

Implementations on Foreign Types§

source§

impl<'a> SomeArray<'a> for &'a [u8]

source§

fn type_name(&self) -> &str

source§

fn len(&self) -> usize

source§

fn get(&self, idx: usize) -> Option<FieldType<'a>>

source§

impl<'a> SomeArray<'a> for Box<dyn SomeArray<'a> + 'a>

source§

fn type_name(&self) -> &str

source§

fn len(&self) -> usize

source§

fn get(&self, idx: usize) -> Option<FieldType<'a>>

source§

impl<'a, T: Scalar + Into<FieldType<'a>>> SomeArray<'a> for &'a [BigEndian<T>]
where BigEndian<T>: Copy,

source§

fn len(&self) -> usize

source§

fn get(&self, idx: usize) -> Option<FieldType<'a>>

source§

fn type_name(&self) -> &str

Implementors§

source§

impl<'a> SomeArray<'a> for Loca<'a>