struct Guard {
position: (usize, usize),
direction: Direction,
}
Expand description
A Guard represented by their position and facing
Fields§
§position: (usize, usize)
§direction: Direction
Implementations§
source§impl Guard
impl Guard
sourcefn step_row(&self, delta: isize, _: &Lab) -> Option<(usize, usize)>
fn step_row(&self, delta: isize, _: &Lab) -> Option<(usize, usize)>
Step up or down row(s) - None if the new row is outside the lab
sourcefn step_column(&self, delta: isize, _: &Lab) -> Option<(usize, usize)>
fn step_column(&self, delta: isize, _: &Lab) -> Option<(usize, usize)>
Step across column(s) - None if the new column is outside the lab
sourcefn next_position(&self, lab: &Lab) -> Option<(usize, usize)>
fn next_position(&self, lab: &Lab) -> Option<(usize, usize)>
Given the current facing, get the next position in that direction
sourcefn with_position(&self, position: (usize, usize)) -> Guard
fn with_position(&self, position: (usize, usize)) -> Guard
A copy of the guard in a new position
sourcefn with_direction(&self, direction: Direction) -> Guard
fn with_direction(&self, direction: Direction) -> Guard
A copy of the guard with a new facing
Trait Implementations§
impl Copy for Guard
impl Eq for Guard
impl StructuralPartialEq for Guard
Auto Trait Implementations§
impl Freeze for Guard
impl RefUnwindSafe for Guard
impl Send for Guard
impl Sync for Guard
impl Unpin for Guard
impl UnwindSafe for Guard
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.