Skip to main content

object_rainbow/
extras.rs

1use crate::*;
2
3pub mod array;
4pub mod fetch_extra;
5
6#[derive(Debug, Clone, ParseAsInline, PartialEq)]
7pub struct Extras<Extra>(pub Extra);
8
9impl<Extra> Deref for Extras<Extra> {
10    type Target = Extra;
11
12    fn deref(&self) -> &Self::Target {
13        &self.0
14    }
15}
16
17impl<Extra> ToOutput for Extras<Extra> {
18    fn to_output(&self, _: &mut impl Output) {}
19}
20
21impl<Extra> InlineOutput for Extras<Extra> {}
22
23impl<I: PointInput> ParseInline<I> for Extras<I::Extra> {
24    fn parse_inline(input: &mut I) -> object_rainbow::Result<Self> {
25        Ok(Self(input.extra().clone()))
26    }
27}
28
29impl<Extra> Tagged for Extras<Extra> {}
30impl<Extra> ListHashes for Extras<Extra> {}
31impl<Extra> Topological for Extras<Extra> {}
32
33impl<Extra: Clone> CanonicalExtra for Extras<Extra> {
34    type Extra = Extra;
35
36    fn canonical_extra(&self) -> Self::Extra {
37        self.0.clone()
38    }
39}