Of course this can't be done like that cause a trait with generic functions not marked as Self: Sized can't be used as a trait object but was wondering if there's a workaround to simulate that behavior in some other way.
You can often define a new trait that isn't generic but whose implementation delegates to the RegisterHook trait. However, I don't think it's possible for this particular use-case when you don't actually take any arguments of the generic type.
Actually I'm trying this and it doesn't work. &dyn Trait`` doesn't necessarily implement Trait but also I need to preserve type information which is lost when using the object trait.
Sure, this technique only works in some cases. For the specific problem of &dyn Trait not implementing Trait, you can define a wrapper struct around the reference and implement the trait for your wrapper.