Closed
Description
I have no idea if this is theoretically easy or impossible or what. But consider this trait from my design for select:
trait SelectPort<T> {
fn recv_ready(self) -> Option<T>;
}
This takes self by value because for a oneshot port, it has to consume the endpoint. But for a stream port, you might not be allowed to have it by value at all, but still expect to be able to select on it. It would be nice to have:
trait SelectPort<T, selfmode> {
fn recv_ready(selfmode) -> Option<T>;
}
and then:
impl <T> SelectPort<T, self> for PortOne<T> ...
impl <T> SelectPort<T, &mut self> for Port<T> ...