Macro freya::prelude::fmt_impls

macro_rules! fmt_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, and impl Debug 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 peek_unchecked(&self) -> ReadableRef<'static, Self> {
        self.value.read_unchecked()
    }
}

fmt_impls!(MyCopyValue<T, S: Storage<T>>);