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