// Copyright © 2024 Collabora, Ltd. // SPDX-License-Identifier: MIT use std::ops::Index; pub enum AttrList { Array(&'static [T]), Uniform(T), } impl Index for AttrList { type Output = T; fn index(&self, idx: usize) -> &T { match self { AttrList::Array(arr) => &arr[idx], AttrList::Uniform(typ) => typ, } } } pub trait AsSlice { type Attr; fn as_slice(&self) -> &[T]; fn as_mut_slice(&mut self) -> &mut [T]; fn attrs(&self) -> AttrList; }