#[unsized_visitor]Expand description
This is an attribute macro that must be used when implementing a
UnsizedVisitor.
It is required to use because a UnsizedVisitor 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::UnsizedVisitor;
struct Visitor;
#[musli_core::de::unsized_visitor(crate = musli_core)]
impl<'de, C> UnsizedVisitor<'de, C, [u8]> for Visitor
where
C: Context,
{
type Ok = ();
#[inline]
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"a reference of bytes"
)
}
}