Trait 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>

Source§

impl<'a, O> SomeArray<'a> for ArrayOfOffsets<'a, O>

Source§

impl<'a, T> SomeArray<'a> for ComputedArrayOfRecords<'a, T>
where T: FontReadWithArgs<'a> + ComputeSize + SomeRecord<'a> + 'a, T::Args: Copy + 'static, Self: 'a,

Source§

impl<'a, T> SomeArray<'a> for VarLenArrayOfRecords<'a, T>
where T: FontRead<'a> + VarSize + SomeRecord<'a> + 'a, Self: 'a,

Source§

impl<'a, T: SomeRecord<'a> + Clone> SomeArray<'a> for ArrayOfRecords<'a, T>