musli_core/de/
entry_decoder.rs1use crate::{Allocator, Context};
2
3use super::{Decoder, SizeHint};
4
5pub trait EntryDecoder<'de> {
7 type Cx: Context<Error = Self::Error, Allocator = Self::Allocator>;
9 type Error;
11 type Allocator: Allocator;
13 type Mode: 'static;
15 type DecodeKey<'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: Decoder<
27 'de,
28 Cx = Self::Cx,
29 Error = Self::Error,
30 Allocator = Self::Allocator,
31 Mode = Self::Mode,
32 >;
33
34 fn cx(&self) -> Self::Cx;
36
37 #[inline]
39 fn size_hint(&self) -> SizeHint {
40 SizeHint::any()
41 }
42
43 #[must_use = "Decoders must be consumed"]
48 fn decode_key(&mut self) -> Result<Self::DecodeKey<'_>, Self::Error>;
49
50 #[must_use = "Decoders must be consumed"]
52 fn decode_value(self) -> Result<Self::DecodeValue, Self::Error>;
53}