So I was trying to overload some operators and then this gave me a compile error:
impl<C> PartialEq<SymMonomial> for C where C: CoefficientRequisites{
fn eq(&self, other: &SymMonomial) -> bool {
other.eq(self)
}
}
The exact error is:
Compiling symints v0.0.1 (file:///media/hdd/work/metadiff/symints)
error[E0210]: type parameter `C` must be used as the type parameter for some local type (e.g. `MyStruct<T>`); only traits defined in the current crate can be implemented for a type parameter
--> src/lib.rs:214:1
|
214 | impl<C> PartialEq<SymMonomial> for C where C: CoefficientRequisites{
| ^
Could someone clarify to me why I can't implement this for C?
Yes, but I was looking for an explanation as to why this is the cases that we can't do this in the first place? This prevents ergonomic operator overloading, rather I need to implement that trait for about 10 primitive types explicitly.