select {
case msg, ok := <-r:
case s <- msg:
case <-time.After(1 * time.Second):
}
Also, do you think this code in Rust should panic if `s` is closed? I'm asking because that's what would happen in Go.
@burntsushi5 - do you perhaps have an opinion?
-
-
Show this thread
-
An alternative might be to have two kinds of `recv` cases: select! { recv(r, msg) => {} // `msg` is of type `T`, doesn't fire if `r` is closed recv?(r, msg) => {} // `msg` is of type `Result<T, RecvError>` send(s, msg) => {} // doesn't panic if `s` is closed }
Show this thread
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.