1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use crate::*;
use std::marker::PhantomData;

#[derive(Debug, Clone)]
pub struct Value<T: Clone, I>(T, PhantomData<I>);

impl<T: Clone, I> Value<T, I> {
    pub(crate) fn new(x: T) -> Self {
        Self(x, PhantomData)
    }
}

impl<T: Clone, I> Scanner for Value<T, I> {
    type Input = I;
    type Output = T;

    fn scan(&self, _: &mut Stream<Self::Input>) -> Res<Self> {
        Ok(self.0.clone())
    }
}