Skip to content

Commit a4d0202

Browse files
feat: impl std::ops::BitOr<Signal> for SigSet
1 parent ca1c755 commit a4d0202

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
@@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1919
([#1959](https://github.com/nix-rust/nix/pull/1959))
2020
- Added `impl std::ops::BitOr for Signal`.
2121
([#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))
2224

2325
### Changed
2426

src/sys/signal.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::{Error, Result};
88
use cfg_if::cfg_if;
99
use std::fmt;
1010
use std::mem;
11+
use std::ops::BitOr;
1112
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
1213
use std::os::unix::io::RawFd;
1314
use std::ptr;
@@ -593,11 +594,9 @@ impl From<Signal> for SigSet {
593594
}
594595
}
595596

596-
597-
impl std::ops::BitOr for Signal {
597+
impl BitOr for Signal {
598598
type Output = SigSet;
599599

600-
// rhs is the "right-hand side" of the expression `a | b`
601600
fn bitor(self, rhs: Self) -> Self::Output {
602601
let mut sigset = SigSet::empty();
603602
sigset.add(self);
@@ -606,7 +605,16 @@ impl std::ops::BitOr for Signal {
606605
}
607606
}
608607

609-
impl std::ops::BitOr for SigSet {
608+
impl BitOr<Signal> for SigSet {
609+
type Output = SigSet;
610+
611+
fn bitor(mut self, rhs: Signal) -> Self::Output {
612+
self.add(rhs);
613+
self
614+
}
615+
}
616+
617+
impl BitOr for SigSet {
610618
type Output = Self;
611619

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

0 commit comments

Comments
 (0)