I am keen to use the new specialization features of Rust, but can't find any documentation on it yet. In particular I would like something like this to work:
struct Special
{
x : usize,
y : usize
}
trait MyTrait
{
fn myfunc(&self);
}
impl<T> MyTrait for T
{
fn myfunc(&self) { println!("hi"); }
}
impl MyTrait for Special
{
fn myfunc(&self) { println!("I'm special"); }
}
The compiler complains about duplicate definitions. Is there any way to make this work?
Specialization is currently only used in the standard library and is still a nightly feature. Also, functions that can be specialized need to be marked as "default"
In general, since there is so much doc work to do, I don't write much
documentation for unstable things, as it might change and need to be
re-done by the time it's stable.