Rather than using a function as a constructor, like:
pure fn PairingHeap<E: Copy Eq Ord>(initial_value: E) -> PairingHeap<E>
{ ... }
let heap = PairingHeap(1);
I believe it's more idiomatic to instead use a static method, as in:
impl<E: Copy Eq Ord> PairingHeap<E> : Eq {
static fn new(initial_value: E) -> PairingHeap<E> { ... }
...
}
let heap = PairingHeap::new(1);
Though this probably only works in 0.5.
IIRC there are also plans to make Ord inherit from Eq, so all the places
where you have `<E: Copy Ord Eq>` can eventually be reduced to just `<E:
Copy Ord>`.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev