File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ pub struct Sender<T> {
196
196
}
197
197
198
198
impl < T > Sender < T > {
199
+
199
200
/// Attempts to send a message into the channel.
200
201
///
201
202
/// If the channel is full or closed, this method returns an error.
@@ -493,6 +494,11 @@ impl<T> Sender<T> {
493
494
channel : self . channel . clone ( ) ,
494
495
}
495
496
}
497
+
498
+ /// Returns whether the senders belong to the same channel.
499
+ pub fn same_channel ( & self , other : & Sender < T > ) -> bool {
500
+ Arc :: ptr_eq ( & self . channel , & other. channel )
501
+ }
496
502
}
497
503
498
504
impl < T > Drop for Sender < T > {
@@ -820,6 +826,11 @@ impl<T> Receiver<T> {
820
826
channel : self . channel . clone ( ) ,
821
827
}
822
828
}
829
+
830
+ /// Returns whether the receivers belong to the same channel.
831
+ pub fn same_channel ( & self , other : & Receiver < T > ) -> bool {
832
+ Arc :: ptr_eq ( & self . channel , & other. channel )
833
+ }
823
834
}
824
835
825
836
impl < T > fmt:: Debug for Receiver < T > {
You can’t perform that action at this time.
0 commit comments