Skip to content

Commit 002ce7c

Browse files
feat: impl std::ops::BitOr for Signal
1 parent 786f65f commit 002ce7c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1515
([#1959](https://github.com/nix-rust/nix/pull/1959))
1616
- Added `impl std::ops::BitOr for SigSet`.
1717
([#1959](https://github.com/nix-rust/nix/pull/1959))
18+
- Added `impl std::ops::BitOr for Signal`.
19+
([#1959](https://github.com/nix-rust/nix/pull/1959))
1820

1921
### Changed
2022

src/sys/signal.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,19 @@ impl From<Signal> for SigSet {
612612
}
613613
}
614614

615+
616+
impl std::ops::BitOr for Signal {
617+
type Output = SigSet;
618+
619+
// rhs is the "right-hand side" of the expression `a | b`
620+
fn bitor(self, rhs: Self) -> Self::Output {
621+
let mut sigset = SigSet::empty();
622+
sigset.add(self);
623+
sigset.add(rhs);
624+
sigset
625+
}
626+
}
627+
615628
impl std::ops::BitOr for SigSet {
616629
type Output = Self;
617630

0 commit comments

Comments
 (0)