pub trait Builder<'buffer> {
type Output;
// Required methods
fn entry<Context>(
&mut self,
key: &'buffer str,
decoder: &mut Decoder<'buffer>,
context: &mut Context,
) -> Result<bool, Error>;
fn build(self) -> Result<Self::Output, Error>;
}
Expand description
A builder that can hold the intermediate state while an object is being decoded from a map.
Required Associated Types§
Required Methods§
Sourcefn entry<Context>(
&mut self,
key: &'buffer str,
decoder: &mut Decoder<'buffer>,
context: &mut Context,
) -> Result<bool, Error>
fn entry<Context>( &mut self, key: &'buffer str, decoder: &mut Decoder<'buffer>, context: &mut Context, ) -> Result<bool, Error>
Accepts a single map entry.
The key
parameter is the string key. The decoder
parameter is positioned at the
corresponding value.
If this builder (or a subordinate builder for a nested object) understands the key, it
should consume the corresponding value and return true
. If not, it should return false
without consuming the corresponding value. This allows delegation to subordinate builders
to work, as only exactly one builder in the tree will directly return true
(as opposed to
doing so via delegation), and only that one builder will consume the value.
§Errors
This fails if the value is not acceptable, for example if it is of the wrong data type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.