Skip to content

Commit 90aa125

Browse files
feat: impl std::ops::BitOr<Signal> for SigSet
1 parent 002ce7c commit 90aa125

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1717
([#1959](https://github.com/nix-rust/nix/pull/1959))
1818
- Added `impl std::ops::BitOr for Signal`.
1919
([#1959](https://github.com/nix-rust/nix/pull/1959))
20+
- Added `impl std::ops::BitOr<Signal> for SigSet`
21+
([#1959](https://github.com/nix-rust/nix/pull/1959))
2022

2123
### Changed
2224

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)