[Pre-RFC] Final Trait Methods

simulating final methods (annoying to define the traits, works well enough from the downstream users/implementers afaict):

pub trait FinalMethodsForAny {
    fn type_id(&self) -> TypeId
    where
        Self: Any,
    {
        ...
    }
}

impl<T: ?Sized> FinalMethodsForAny for T {}

pub trait Any: FinalMethodsForAny + 'static {
    // ...
}
1 Like