#[visitor]Expand description
This is an attribute macro that must be used when implementing a
Visitor.
It is required to use because a Visitor implementation might introduce
new associated types in the future, and this is not yet supported on a
language level in Rust. So this attribute macro polyfills any missing types
automatically.
Note that using derives directly from musli_core requires you to use the
#[musli_core::visitor(crate = musli_core)] attribute.
ยงExamples
use std::fmt;
use musli_core::Context;
use musli_core::de::Visitor;
struct AnyVisitor;
#[musli_core::de::visitor(crate = musli_core)]
impl<'de, C> Visitor<'de, C> for AnyVisitor
where
C: Context,
{
type Ok = ();
#[inline]
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"a value that can be decoded into dynamic container"
)
}
}