Skip to content

Commit

Permalink
feat: impl std::ops::BitOr<Signal> for SigSet
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanWoollett-Light committed Jan 8, 2023
1 parent 5abe0ea commit da26900
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{Error, Result};
use cfg_if::cfg_if;
use std::fmt;
use std::mem;
use std::ops::BitOr;
#[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
use std::os::unix::io::RawFd;
use std::ptr;
Expand Down Expand Up @@ -593,11 +594,9 @@ impl From<Signal> for SigSet {
}
}


impl std::ops::BitOr for Signal {
impl BitOr for Signal {
type Output = SigSet;

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

impl std::ops::BitOr for SigSet {
impl BitOr<Signal> for SigSet {
type Output = SigSet;

fn bitor(mut self, rhs: Signal) -> Self::Output {
self.add(rhs);
self
}
}

impl BitOr for SigSet {
type Output = Self;

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

0 comments on commit da26900

Please sign in to comment.