File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1111
1212- Fixed the function signature of ` recvmmsg ` , potentially causing UB
1313 ([ #2119 ] ( https://github.com/nix-rust/nix/issues/2119 ) )
14+ ### Added
15+
16+ - Added ` impl From<Signal> for SigSet ` .
17+ ([ #1959 ] ( https://github.com/nix-rust/nix/pull/1959 ) )
18+ - Added ` impl std::ops::BitOr for SigSet ` .
19+ ([ #1959 ] ( https://github.com/nix-rust/nix/pull/1959 ) )
20+ - Added ` impl std::ops::BitOr for Signal ` .
21+ ([ #1959 ] ( https://github.com/nix-rust/nix/pull/1959 ) )
22+ - Added ` impl std::ops::BitOr<Signal> for SigSet `
23+ ([ #1959 ] ( https://github.com/nix-rust/nix/pull/1959 ) )
1424
1525- Fix ` SignalFd::set_mask ` . In 0.27.0 it would actually close the file
1626 descriptor.
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use cfg_if::cfg_if;
99use std:: fmt;
1010use std:: hash:: { Hash , Hasher } ;
1111use std:: mem;
12+ use std:: ops:: BitOr ;
1213#[ cfg( any( target_os = "dragonfly" , target_os = "freebsd" ) ) ]
1314use std:: os:: unix:: io:: RawFd ;
1415use std:: ptr;
@@ -604,6 +605,42 @@ impl SigSet {
604605 }
605606}
606607
608+ impl From <Signal > for SigSet {
609+ fn from( signal: Signal ) -> SigSet {
610+ let mut sigset = SigSet :: empty( ) ;
611+ sigset. add( signal) ;
612+ sigset
613+ }
614+ }
615+
616+ impl BitOr for Signal {
617+ type Output = SigSet ;
618+
619+ fn bitor( self , rhs: Self ) -> Self :: Output {
620+ let mut sigset = SigSet :: empty( ) ;
621+ sigset. add( self ) ;
622+ sigset. add( rhs) ;
623+ sigset
624+ }
625+ }
626+
627+ impl BitOr <Signal > for SigSet {
628+ type Output = SigSet ;
629+
630+ fn bitor( mut self , rhs: Signal ) -> Self :: Output {
631+ self . add( rhs) ;
632+ self
633+ }
634+ }
635+
636+ impl BitOr for SigSet {
637+ type Output = Self ;
638+
639+ fn bitor( self , rhs: Self ) -> Self :: Output {
640+ self . iter( ) . chain( rhs. iter( ) ) . collect( )
641+ }
642+ }
643+
607644impl AsRef <libc:: sigset_t> for SigSet {
608645 fn as_ref( & self ) -> & libc:: sigset_t {
609646 & self . sigset
You can’t perform that action at this time.
0 commit comments