object_rainbow/impls/
array.rs1use std::ops::Mul;
2
3use typenum::ToUInt;
4
5use crate::*;
6
7impl<T: InlineOutput, const N: usize> ToOutput for [T; N] {
8 fn to_output(&self, output: &mut dyn Output) {
9 T::slice_to_output(self, output);
10 }
11}
12
13impl<T: InlineOutput, const N: usize> InlineOutput for [T; N] {}
14
15impl<T: ListHashes, const N: usize> ListHashes for [T; N] {
16 fn list_hashes(&self, f: &mut impl FnMut(Hash)) {
17 self.iter_list_hashes(f);
18 }
19}
20
21impl<T: Topological, const N: usize> Topological for [T; N] {
22 fn traverse(&self, visitor: &mut impl PointVisitor) {
23 self.iter_traverse(visitor);
24 }
25}
26
27impl<T: Tagged, const N: usize> Tagged for [T; N] {
28 const TAGS: Tags = T::TAGS;
29}
30
31impl<T: Size, const N: usize> Size for [T; N]
32where
33 typenum::generic_const_mappings::Const<N>:
34 ToUInt<Output: Unsigned + Mul<T::Size, Output: Unsigned>>,
35{
36 const SIZE: usize = T::SIZE * N;
37 type Size =
38 <<typenum::generic_const_mappings::Const<N> as ToUInt>::Output as Mul<T::Size>>::Output;
39}