Struct lighthouse_protocol::Rect
source · pub struct Rect {
pub origin: Pos,
pub size: Delta,
}
Expand description
A rectangle on the integer grid.
Fields§
§origin: Pos
§size: Delta
Implementations§
source§impl Rect
impl Rect
sourcepub const fn contains(self, pos: Pos) -> bool
pub const fn contains(self, pos: Pos) -> bool
Checks whether the rectangle contains the given position.
sourcepub fn sample_random_with(self, rng: &mut impl Rng) -> Option<Pos>
pub fn sample_random_with(self, rng: &mut impl Rng) -> Option<Pos>
Samples a random position within the rectangle with the given rng.
sourcepub fn sample_random(self) -> Option<Pos>
pub fn sample_random(self) -> Option<Pos>
Samples a random position within the rectangle.
Trait Implementations§
source§impl PartialEq for Rect
impl PartialEq for Rect
impl Copy for Rect
impl Eq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more