| 1 |
use std::ops::{BitOr, BitOrAssign}; |
| 2 |
|
| 3 |
use crate::Style; |
| 4 |
|
| 5 |
impl<T: Into<Set<T>>> BitOr<T> for Set<T> { |
| 6 |
type Output = Self; |
| 7 |
|
| 8 |
fn bitor(self, rhs: T) -> Self::Output { |
| 9 |
Set(PhantomData, self.1 | rhs.into().1) |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
impl<T: Into<Set<T>>> BitOr<Set<T>> for Set<T> { |
| 14 |
type Output = Self; |
| 15 |
|
| 16 |
fn bitor(self, rhs: Set<T>) -> Self::Output { |
| 17 |
Set(PhantomData, self.1 | rhs.1) |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
impl<T: Into<Set<T>>> BitOrAssign<T> for Set<T> { |
| 22 |
fn bitor_assign(&mut self, rhs: T) { |
| 23 |
self.1 |= rhs.into().1; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
impl BitOr for Emphasis { |
| 28 |
type Output = Style; |
| 29 |
|
| 30 |
fn bitor(self, rhs: Self) -> Style { |
| 31 |
let attribute = Set::from(self) | Set::from(rhs); |
| 32 |
Style { attribute, ..Default::default() } |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
impl BitOr<Style> for Emphasis { |
| 37 |
type Output = Style; |
| 38 |
|
| 39 |
fn bitor(self, mut rhs: Style) -> Style { |
| 40 |
rhs.attribute |= self; |
| 41 |
rhs |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
impl BitOr<Emphasis> for Style { |
| 46 |
type Output = Style; |
| 47 |
|
| 48 |
fn bitor(self, rhs: Emphasis) -> Style { |
| 49 |
rhs | self |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
impl BitOr<Emphasis> for Color { |
| 54 |
type Output = Style; |
| 55 |
|
| 56 |
fn bitor(self, rhs: Emphasis) -> Self::Output { |
| 57 |
Style::from(self) | rhs |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
impl BitOr<Color> for Emphasis { |
| 62 |
type Output = Style; |
| 63 |
|
| 64 |
fn bitor(self, rhs: Color) -> Self::Output { |
| 65 |
Style::from(rhs) | self |
| 66 |
} |
| 67 |
} |