File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,13 @@ pub mod channel {
446446
447447 impl < T : RpcMessage > Sender < T > {
448448 /// Send a message and yield until either it is sent or an error occurs.
449+ ///
450+ /// ## Cancellation safety
451+ ///
452+ /// If the future is dropped before completion, and if this is a remote sender,
453+ /// then the sender will be closed and further sends will return an [`io::Error`]
454+ /// with [`io::ErrorKind::BrokenPipe`]. Therefore, make sure to always poll the
455+ /// future until completion if you want to reuse the sender or any clone afterwards.
449456 pub async fn send ( & self , value : T ) -> std:: result:: Result < ( ) , SendError > {
450457 match self {
451458 Sender :: Tokio ( tx) => {
@@ -469,6 +476,13 @@ pub mod channel {
469476 /// all.
470477 ///
471478 /// Returns true if the message was sent.
479+ ///
480+ /// ## Cancellation safety
481+ ///
482+ /// If the future is dropped before completion, and if this is a remote sender,
483+ /// then the sender will be closed and further sends will return an [`io::Error`]
484+ /// with [`io::ErrorKind::BrokenPipe`]. Therefore, make sure to always poll the
485+ /// future until completion if you want to reuse the sender or any clone afterwards.
472486 pub async fn try_send ( & mut self , value : T ) -> std:: result:: Result < bool , SendError > {
473487 match self {
474488 Sender :: Tokio ( tx) => match tx. try_send ( value) {
You can’t perform that action at this time.
0 commit comments