#[thin_delegate::external_trait_def] mod __external_trait_def { #[thin_delegate::register] pub trait AsRef { /// Converts this type into a shared reference of the (usually inferred) input type. #[stable(feature = "rust1", since = "1.0.0")] fn as_ref(&self) -> &T; } } #[thin_delegate::register] struct Hoge(Box usize>); #[thin_delegate::derive_delegate(external_trait_def = __external_trait_def)] impl AsRef<(dyn Fn(usize) -> usize + 'static)> for Hoge {} fn main() {}