I am implementing a struct with a generic bounded to a trait, but that implementation is desirable to feature functions that bound the generic even more. Below is the example:
struct A<T> {
data: T
}
impl <T: AsRef<[u8]>> A<T> {
fn test(&self, t: &T) {}
fn more_bound<S: AsRef<[u8]> + PartialEq>(&self, t: &S) {
self.test(t);
}
}
I cannot really use a specialization as I don't implement a trait. Neither would I like to define a trait.
Are there any other options except changing the signature of test to
fn test(&self, t: &impl AsRef<[u8]>) {}?
Because such an approach seems to defeat the purpose of generics (in this case).
struct'simpl.