macro_rules! stateful {
(
$Obj:ident ($($storage:tt)+): /*{ $($accessors:tt)* } no traits no accessors */
$Readonly:ident { $($readonlies:tt)* }
$Writable:ident { $($writables:tt)* }
) => { ... };
}
Expand description
Because Rust can’t yet genericize over mutability, this macro can be used
to implement the same readonly methods twice - once for &S
and for &mut S
.