What I want to do is like this following
use num::integer::Roots;
use num::traits::real::Real;
pub trait Sqrt {
fn sqrt(self) -> Self;
}
impl<T: Real> Sqrt for T {
fn sqrt(self) -> Self {
T::sqrt(self)
}
}
impl<T: Roots> Sqrt for T {
fn sqrt(self) -> Self {
Roots::sqrt(&self)
}
}
But compiler complains as this
error[E0119]: conflicting implementations of trait core::Sqrt
:
--> src\core\mod.rs:22:1
|
16 | impl<T: Real> Sqrt for T {
| ------------------------ first implementation here
...
22 | impl<T: Roots> Sqrt for T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation