mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Implement BitOr and BitOrAssign for Rect (#7319)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::fmt;
|
||||
|
||||
use crate::{Div, Mul, NumExt as _, Pos2, Rangef, Rot2, Vec2, lerp, pos2, vec2};
|
||||
use std::ops::{BitOr, BitOrAssign};
|
||||
|
||||
/// A rectangular region of space.
|
||||
///
|
||||
@@ -776,6 +777,22 @@ impl Div<f32> for Rect {
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOr for Rect {
|
||||
type Output = Self;
|
||||
|
||||
#[inline]
|
||||
fn bitor(self, other: Self) -> Self {
|
||||
self.union(other)
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOrAssign for Rect {
|
||||
#[inline]
|
||||
fn bitor_assign(&mut self, other: Self) {
|
||||
*self = self.union(other);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user