Skip to content

Commit e13809b

Browse files
feat: impl std::ops::BitOr<Signal> for SigSet
1 parent 5abe0ea commit e13809b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/sys/signal.rs

Lines changed: 12 additions & 3 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;
@@ -594,10 +595,9 @@ impl From<Signal> for SigSet {
594595
}
595596

596597

597-
impl std::ops::BitOr for Signal {
598+
impl BitOr for Signal {
598599
type Output = SigSet;
599600

600-
// rhs is the "right-hand side" of the expression `a | b`
601601
fn bitor(self, rhs: Self) -> Self::Output {
602602
let mut sigset = SigSet::empty();
603603
sigset.add(self);
@@ -606,7 +606,16 @@ impl std::ops::BitOr for Signal {
606606
}
607607
}
608608

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

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

0 commit comments

Comments
 (0)