1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Implement BitOr and BitOrAssign for Rect

This commit is contained in:
lucasmerlin
2025-07-09 14:55:13 +02:00
parent 207e71c2ae
commit 86d1c0e40a
10 changed files with 32 additions and 15 deletions

View File

@@ -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::*;