Macro spacetimedb_sats::impl_deserialize
source · macro_rules! impl_deserialize { ([$($generics:tt)*] $(where [$($wc:tt)*])? $typ:ty, $de:ident => $body:expr) => { ... }; }
Expand description
Implements Deserialize
for a type in a simplified manner.
An example:
ⓘ
impl_deserialize!(
// Type parameters Optional where Impl type
// v v v
// ---------------- --------------- ----------
[T: Deserialize<'de>] where [T: Copy] std::rc::Rc<T>,
// The `deserialize` implementation where `de` is the `Deserializer<'de>`
// and the expression right of `=>` is the body of `deserialize`.
de => T::deserialize(de).map(std::rc::Rc::new)
);