Debian Codegraph @

third_party/rust/serde_path_to_error/src/wrap.rs

raw
1 use crate::{Chain, Track};
2
3 // Wrapper that attaches context to a `Visitor`, `SeqAccess` or `EnumAccess`.
4 pub struct Wrap<'a, 'b, X> {
5 pub(crate) delegate: X,
6 pub(crate) chain: &'a Chain<'a>,
7 pub(crate) track: &'b Track,
8 }
9
10 // Wrapper that attaches context to a `VariantAccess`.
11 pub struct WrapVariant<'a, 'b, X> {
12 pub(crate) delegate: X,
13 pub(crate) chain: Chain<'a>,
14 pub(crate) track: &'b Track,
15 }
16
17 impl<'a, 'b, X> Wrap<'a, 'b, X> {
18 pub(crate) fn new(delegate: X, chain: &'a Chain<'a>, track: &'b Track) -> Self {
19 Wrap {
20 delegate,
21 chain,
22 track,
23 }
24 }
25 }
26
27 impl<'a, 'b, X> WrapVariant<'a, 'b, X> {
28 pub(crate) fn new(delegate: X, chain: Chain<'a>, track: &'b Track) -> Self {
29 WrapVariant {
30 delegate,
31 chain,
32 track,
33 }
34 }
35 }