Skip to content

Commit 34bdc08

Browse files
committed
Added comment about why calling unwrap is safe
1 parent 1656653 commit 34bdc08

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rclrs/src/node/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ where
192192
.ok()?;
193193
let (tx, rx) = oneshot::channel::<T::Response>();
194194
self.futures.lock().insert(sequence_number, tx);
195+
// It is safe to call unwrap() here since the `Canceled` error will only happen when the
196+
// `Sender` is dropped
197+
// https://docs.rs/futures/latest/futures/channel/oneshot/struct.Canceled.html
195198
Ok(rx.await.unwrap())
196199
}
197200

0 commit comments

Comments
 (0)