Skip to content

Commit da26900

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

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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)