pub struct CostGrid { /* private fields */ }Expand description
Owned row-major grid of per-cell costs.
Implementations§
Source§impl CostGrid
impl CostGrid
Sourcepub fn new(size: UVec2, cost: f32) -> Self
pub fn new(size: UVec2, cost: f32) -> Self
Creates a grid where every cell costs cost.
Panics if cost is not finite and positive or the grid is too large.
Sourcepub fn set(&mut self, cell: UVec2, cost: Option<f32>)
pub fn set(&mut self, cell: UVec2, cost: Option<f32>)
Sets a cell’s cost, or blocks it with None.
Panics if cell is outside the grid or cost is not finite and positive.
Sourcepub fn block_rect(&mut self, min: UVec2, max: UVec2)
pub fn block_rect(&mut self, min: UVec2, max: UVec2)
Blocks every cell in the inclusive rectangle min..=max, clamped to the grid.
Trait Implementations§
impl StructuralPartialEq for CostGrid
Auto Trait Implementations§
impl Freeze for CostGrid
impl RefUnwindSafe for CostGrid
impl Send for CostGrid
impl Sync for CostGrid
impl Unpin for CostGrid
impl UnsafeUnpin for CostGrid
impl UnwindSafe for CostGrid
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