pub trait DecodePartial<S: ErrorSpan>: Sized {
// Required methods
fn insert_child(
&mut self,
node: &SpannedNode<S>,
ctx: &mut Context<S>,
) -> Result<bool, DecodeError<S>>;
fn insert_property(
&mut self,
name: &Spanned<Box<str>, S>,
value: &Value<S>,
ctx: &mut Context<S>,
) -> Result<bool, DecodeError<S>>;
}Expand description
The trait is implemented for structures that can be used as part of other structs
The type of field that #[knuffel(flatten)] is used for should implement
this trait. It is automatically implemented by #[derive(knuffel::Decode)]
by structures that have only optional properties and children (no
arguments).
Required Methods§
Sourcefn insert_child(
&mut self,
node: &SpannedNode<S>,
ctx: &mut Context<S>,
) -> Result<bool, DecodeError<S>>
fn insert_child( &mut self, node: &SpannedNode<S>, ctx: &mut Context<S>, ) -> Result<bool, DecodeError<S>>
The method is called when unknown child is encountered by parent structure
Returns Ok(true) if the child is “consumed” (i.e. stored in this
structure).
Sourcefn insert_property(
&mut self,
name: &Spanned<Box<str>, S>,
value: &Value<S>,
ctx: &mut Context<S>,
) -> Result<bool, DecodeError<S>>
fn insert_property( &mut self, name: &Spanned<Box<str>, S>, value: &Value<S>, ctx: &mut Context<S>, ) -> Result<bool, DecodeError<S>>
The method is called when unknown property is encountered by parent structure
Returns Ok(true) if the property is “consumed” (i.e. stored in this
structure).
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.