Skip to main content

object_rainbow/extras/
array.rs

1use crate::{
2    extras::Extras, map_extra::MappedExtra, runtime_array::RuntimeArray, tuple_extra::Extra1, *,
3};
4
5#[derive(
6    Debug,
7    ToOutput,
8    InlineOutput,
9    ListHashes,
10    Topological,
11    Tagged,
12    Parse,
13    ParseInline,
14    PartialEq,
15    Clone,
16)]
17pub struct ExtraArray<T, E> {
18    pub extra: MappedExtra<Extras<E>, Extra1>,
19    pub items: RuntimeArray<T>,
20}
21
22impl<T, E: Clone> CanonicalExtra for ExtraArray<T, E> {
23    type Extra = (u64, E);
24
25    fn canonical_extra(&self) -> Self::Extra {
26        (self.items.len() as _, self.extra.1.0.clone())
27    }
28}