Given the following trait:
trait Trait {
fn test(&self) { println!("default implementation"); }
}
To provide a default specialization on Trait::test, test must be redefined;
impl<T> Trait for T {
default fn test(&self) { println!("default implementation"); }
}
However this violates the DRY principle. The solution here would be to provide a way to delegate the implementation of test to the already existing default implementation found in the trait definition.
Proposed syntax to allow for this delegation:
impl<T> Trait for T {
default fn test(&self);
}
Given the following trait:
To provide a default specialization on
Trait::test,testmust be redefined;However this violates the DRY principle. The solution here would be to provide a way to delegate the implementation of
testto the already existing default implementation found in the trait definition.Proposed syntax to allow for this delegation: