Skip to main content

object_rainbow/
inline_extra.rs

1use crate::{map_extra::Map, *};
2
3/// Parses `Extra`, then provides it to `T`'s parser.
4#[derive(
5    Debug,
6    ToOutput,
7    InlineOutput,
8    Tagged,
9    ListHashes,
10    Topological,
11    Clone,
12    Copy,
13    Parse,
14    ParseInline,
15    PartialEq,
16)]
17pub struct InlineExtra<Extra = ()>(pub Extra);
18
19impl<E: 'static + Clone, X: 'static + Clone> Map<X> for InlineExtra<E> {
20    type Mapped = (E, X);
21
22    fn map(&self, extra: X) -> Self::Mapped {
23        (self.0.clone(), extra)
24    }
25}