1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::{Chain, Track};

// Wrapper that attaches context to a `Visitor`, `SeqAccess` or `EnumAccess`.
pub struct Wrap<'a, 'b, X> {
    pub(crate) delegate: X,
    pub(crate) chain: &'a Chain<'a>,
    pub(crate) track: &'b Track,
}

// Wrapper that attaches context to a `VariantAccess`.
pub struct WrapVariant<'a, 'b, X> {
    pub(crate) delegate: X,
    pub(crate) chain: Chain<'a>,
    pub(crate) track: &'b Track,
}

impl<'a, 'b, X> Wrap<'a, 'b, X> {
    pub(crate) fn new(delegate: X, chain: &'a Chain<'a>, track: &'b Track) -> Self {
        Wrap {
            delegate,
            chain,
            track,
        }
    }
}

impl<'a, 'b, X> WrapVariant<'a, 'b, X> {
    pub(crate) fn new(delegate: X, chain: Chain<'a>, track: &'b Track) -> Self {
        WrapVariant {
            delegate,
            chain,
            track,
        }
    }
}