diff options
Diffstat (limited to 'third_party/rust/serde_path_to_error/src/wrap.rs')
-rw-r--r-- | third_party/rust/serde_path_to_error/src/wrap.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/third_party/rust/serde_path_to_error/src/wrap.rs b/third_party/rust/serde_path_to_error/src/wrap.rs new file mode 100644 index 0000000000..d730995a71 --- /dev/null +++ b/third_party/rust/serde_path_to_error/src/wrap.rs @@ -0,0 +1,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, + } + } +} |