macro_rules! read_impls { ( $ty:ident // Accept generics < T $(, $gen:ident $(: $gen_bound:path)?)* $(,)?> // Accept extra bounds $( where $( $extra_bound_ty:ident: $extra_bound:path ),+ )? ) => { ... }; }
Expand description
This macro is used to generate impl Display
, impl Debug
, impl PartialEq
, and impl Eq
blocks for any Readable type that takes a generic T
ยงExample
use generational_box::*;
use dioxus::prelude::*;
struct MyCopyValue<T: 'static, S: Storage<T>> {
value: CopyValue<T, S>,
}
impl<T: 'static, S: Storage<T>> Readable for MyCopyValue<T, S> {
type Target = T;
type Storage = S;
fn try_read_unchecked(
&self,
) -> Result<ReadableRef<'static, Self>, generational_box::BorrowError> {
self.value.try_read_unchecked()
}
fn try_peek_unchecked(
&self,
) -> Result<ReadableRef<'static, Self>, generational_box::BorrowError> {
self.value.try_read_unchecked()
}
}
read_impls!(MyCopyValue<T, S: Storage<T>>);