pub struct Snake {
pub body: Vec<(i32, i32)>,
/* private fields */
}Fields§
§body: Vec<(i32, i32)>Implementations§
Source§impl Snake
impl Snake
pub fn new(head: (i32, i32), dir: Direction, length: usize) -> Self
pub fn len(&self) -> usize
pub fn head(&self) -> (i32, i32)
pub fn add_tail(&mut self, d: (i32, i32))
pub fn show(&self, frame: &mut Frame) -> Result<()>
pub fn move_one_step(&mut self, k: &Direction) -> Result<(i32, i32)>
pub fn included(&self, point: &(usize, usize)) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Snake
impl RefUnwindSafe for Snake
impl Send for Snake
impl Sync for Snake
impl Unpin for Snake
impl UnwindSafe for Snake
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