File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -404,3 +404,15 @@ pub enum Broadcaster {
404404 /// Received over the network from a remote client.
405405 Remote ( ClientId ) ,
406406}
407+
408+ impl Broadcaster {
409+ /// Returns `true` if the message was written locally.
410+ pub fn is_local ( self ) -> bool {
411+ matches ! ( self , Self :: Local )
412+ }
413+
414+ /// Returns `true` if the message was received from a remote client.
415+ pub fn is_remote ( self ) -> bool {
416+ matches ! ( self , Self :: Remote ( _) )
417+ }
418+ }
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ fn without_plugins() {
143143 . drain ( )
144144 . collect ( ) ;
145145 assert_eq ! ( broadcasts. len( ) , 1 ) ;
146- assert ! ( matches! ( broadcasts[ 0 ] . broadcaster, Broadcaster :: Remote ( _ ) ) ) ;
146+ assert ! ( broadcasts[ 0 ] . broadcaster. is_remote ( ) ) ;
147147}
148148
149149#[ test]
You can’t perform that action at this time.
0 commit comments