object_rainbow/inline_extra.rs
1use crate::{map_extra::MapExtra, *};
2
3/// Parses `Extra`, then provides it to `T`'s parser.
4#[derive(Debug, ToOutput, InlineOutput, Tagged, ListHashes, Topological, Clone, Copy)]
5pub struct InlineExtra<Extra = ()>(pub Extra);
6
7impl<E: 'static + Clone, X: 'static + Clone> MapExtra<X> for InlineExtra<E> {
8 type Mapped = (E, X);
9
10 fn map_extra(&self, extra: X) -> Self::Mapped {
11 (self.0.clone(), extra)
12 }
13}