use rkyv::Archive; use rkyv_impl::*; #[derive(Archive)] pub struct Foo { field: T, } pub trait MakeBar { type Bar; fn make_bar(&self) -> Self::Bar; } #[archive_impl(transform_bounds(T))] impl Foo where ::Bar: Into, { fn get_bar_u32(&self) -> u32 { self.field.make_bar().into() } } fn call_archived(foo: ArchivedFoo) -> u32 where T::Archived: MakeBar, ::Bar: Into, { foo.get_bar_u32() } fn main() {}