Skip to content

Commit b4443d9

Browse files
author
Jonathan Woollett-Light
committed
feat: impl std::ops::BitOr<Signal> for SigSet
1 parent d207a0d commit b4443d9

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3333
relaxed lifetime requirements relative to 0.27.1.
3434
([#2136](https://github.com/nix-rust/nix/pull/2136))
3535

36+
### Added
37+
38+
- Added `impl std::ops::BitOr<Signal> for SigSet`
39+
([#1959](https://github.com/nix-rust/nix/pull/1959))
40+
3641
## [0.27.1] - 2023-08-28
3742

3843
### Fixed

src/sys/signal.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use cfg_if::cfg_if;
99
use std::fmt;
1010
use std::hash::{Hash, Hasher};
1111
use std::mem;
12+
use std::ops::BitOr;
1213
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
1314
use std::os::unix::io::RawFd;
1415
use std::ptr;
@@ -612,11 +613,9 @@ impl From<Signal> for SigSet {
612613
}
613614
}
614615

615-
616-
impl std::ops::BitOr for Signal {
616+
impl BitOr for Signal {
617617
type Output = SigSet;
618618

619-
// rhs is the "right-hand side" of the expression `a | b`
620619
fn bitor(self, rhs: Self) -> Self::Output {
621620
let mut sigset = SigSet::empty();
622621
sigset.add(self);
@@ -625,7 +624,16 @@ impl std::ops::BitOr for Signal {
625624
}
626625
}
627626

628-
impl std::ops::BitOr for SigSet {
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 {
629637
type Output = Self;
630638

631639
fn bitor(self, rhs: Self) -> Self::Output {

0 commit comments

Comments
 (0)