pub struct GridGraph<A> {
pub height: usize,
pub width: usize,
/* private fields */
}
Fields§
§height: usize
§width: usize
Implementations§
Source§impl<A> GridGraph<A>
impl<A> GridGraph<A>
Sourcepub fn new(height: usize, width: usize) -> Self
pub fn new(height: usize, width: usize) -> Self
Examples found in repository?
crates/competitive/src/graph/grid.rs (line 16)
15 pub fn new_adj4(height: usize, width: usize) -> Self {
16 Self::new(height, width)
17 }
18 pub fn adj4(&self, vid: (usize, usize)) -> GridAdjacency<Adj4> {
19 GridAdjacency {
20 g: self,
21 xy: vid,
22 diter: GridDirectionIter::default(),
23 _marker: PhantomData,
24 }
25 }
26}
27impl GridGraph<Adj8> {
28 pub fn new_adj8(height: usize, width: usize) -> Self {
29 Self::new(height, width)
30 }
Sourcepub fn move_by_diff(
&self,
xy: (usize, usize),
dxdy: (isize, isize),
) -> Option<(usize, usize)>
pub fn move_by_diff( &self, xy: (usize, usize), dxdy: (isize, isize), ) -> Option<(usize, usize)>
pub fn flat(&self, xy: (usize, usize)) -> usize
pub fn unflat(&self, pos: usize) -> (usize, usize)
Trait Implementations§
Source§impl Adjacencies for GridGraph<Adj4>
impl Adjacencies for GridGraph<Adj4>
Source§impl Adjacencies for GridGraph<Adj8>
impl Adjacencies for GridGraph<Adj8>
Source§impl<'a, M, T> AdjacencyView<'a, M, T> for GridGraph<Adj4>where
M: 'a + Fn(GridDirection) -> T,
impl<'a, M, T> AdjacencyView<'a, M, T> for GridGraph<Adj4>where
M: 'a + Fn(GridDirection) -> T,
Source§impl<'a, M, T> AdjacencyView<'a, M, T> for GridGraph<Adj8>where
M: 'a + Fn(GridDirection) -> T,
impl<'a, M, T> AdjacencyView<'a, M, T> for GridGraph<Adj8>where
M: 'a + Fn(GridDirection) -> T,
Source§impl<A, T> VertexMap<T> for GridGraph<A>
impl<A, T> VertexMap<T> for GridGraph<A>
type Vmap = Vec<Vec<T>>
fn construct_vmap<F>(&self, f: F) -> Self::Vmapwhere
F: FnMut() -> T,
fn vmap_get<'a>(&self, map: &'a Self::Vmap, (x, y): Self::VIndex) -> &'a T
fn vmap_get_mut<'a>( &self, map: &'a mut Self::Vmap, (x, y): Self::VIndex, ) -> &'a mut T
fn vmap_set(&self, map: &mut Self::Vmap, vid: Self::VIndex, x: T)
impl<A: Copy> Copy for GridGraph<A>
Auto Trait Implementations§
impl<A> Freeze for GridGraph<A>
impl<A> RefUnwindSafe for GridGraph<A>
impl<A> Send for GridGraph<A>
impl<A> Sync for GridGraph<A>
impl<A> Unpin for GridGraph<A>
impl<A> UnwindSafe for GridGraph<A>
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