musli_core/de/
variant_decoder.rs1use crate::{Allocator, Context};
2
3use super::Decoder;
4
5pub trait VariantDecoder<'de> {
7 type Cx: Context<Error = Self::Error, Allocator = Self::Allocator>;
9 type Error;
11 type Allocator: Allocator;
13 type Mode: 'static;
15 type DecodeTag<'this>: Decoder<
17 'de,
18 Cx = Self::Cx,
19 Error = Self::Error,
20 Allocator = Self::Allocator,
21 Mode = Self::Mode,
22 >
23 where
24 Self: 'this;
25 type DecodeValue<'this>: Decoder<
27 'de,
28 Cx = Self::Cx,
29 Error = Self::Error,
30 Allocator = Self::Allocator,
31 Mode = Self::Mode,
32 >
33 where
34 Self: 'this;
35
36 fn cx(&self) -> Self::Cx;
38
39 #[must_use = "Decoders must be consumed"]
44 fn decode_tag(&mut self) -> Result<Self::DecodeTag<'_>, Self::Error>;
45
46 #[must_use = "Decoders must be consumed"]
48 fn decode_value(&mut self) -> Result<Self::DecodeValue<'_>, Self::Error>;
49}