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

Implement BitOr and BitOrAssign for Rect (#7319)

This commit is contained in:
Lucas Meurer
2025-07-09 15:29:51 +02:00
committed by GitHub
parent 207e71c2ae
commit 9fd0ad36e0
16 changed files with 45 additions and 32 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::*;