pub struct Unit { /* private fields */ }
Expand description
The controllable unit moving on the grid.
Implementations§
Source§impl Unit
impl Unit
Sourcepub fn get_symbol(self) -> char
pub fn get_symbol(self) -> char
Symbol used when printing the world.
Sourcepub fn deduct_movement(&mut self)
pub fn deduct_movement(&mut self)
Consume one movement point.
Sourcepub fn get_movement(self) -> i8
pub fn get_movement(self) -> i8
Remaining movement points.
Sourcepub fn reset_movement(&mut self)
pub fn reset_movement(&mut self)
Reset movement to one point.
Sourcepub fn get_position(self) -> (usize, usize)
pub fn get_position(self) -> (usize, usize)
Current coordinates (x, y)
.
Sourcepub fn set_position(&mut self, x: usize, y: usize)
pub fn set_position(&mut self, x: usize, y: usize)
Set coordinates to (x, y)
.
Trait Implementations§
impl Copy for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more