1use num_bigint::BigUint;
4
5pub mod ctx;
6pub mod load;
7pub mod store;
8
9pub trait CellReprSize {
11 const SIZE: usize;
13}
14
15impl<const N: usize, T: CellReprSize> CellReprSize for [T; N] {
16 const SIZE: usize = N * T::SIZE;
17}
18
19macro_rules! zero_size_repr {
20 ($t:ty) => {
21 impl crate::cells::CellReprSize for $t {
22 const SIZE: usize = 0;
23 }
24 };
25}
26
27zero_size_repr!(bool);
28zero_size_repr!(u8);
29zero_size_repr!(usize);
30zero_size_repr!(BigUint);
31
32macro_rules! tuple_size {
33 () => {
34 impl CellReprSize for () {
35 const SIZE: usize = 0;
36 }
37 };
38 ($h:ident $(,$t:ident)* $(,)?) => {
39 tuple_size!($( $t, )*);
40
41 impl<$h, $( $t, )*> CellReprSize for (
42 $h, $( $t, )*
43 )
44 where
45 $h: CellReprSize,
46 $( $t: CellReprSize, )*
47 {
48 const SIZE: usize = $h::SIZE + $( $t::SIZE + )* 0;
49
50 }
51 };
52}
53
54tuple_size!(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12);