Browse Source

Removed superfluous generics

master
Thomas Johnson 2 years ago
parent
commit
275274e289
  1. 11
      src/head.rs
  2. 4
      src/main.rs

11
src/head.rs

@ -1,6 +1,6 @@
use std::rc::Rc;
use core::fmt::Debug;
use core::ops::Deref;
use core::cell::RefCell;
use crate::grid::{add_v2, Grid, Direction};
@ -14,16 +14,15 @@ pub enum HeadMode {
}
#[derive(Clone, Debug)]
pub struct Head<G: Clone + Debug> {
grid: G,
pub struct Head {
grid: Rc<RefCell<Grid>>,
down: bool,
mode: HeadMode,
coords: (isize, isize),
}
impl<G> Head<G> where
G: Clone + Debug + Deref<Target=RefCell<Grid>> {
pub fn new_at(grid: G, coords: (isize, isize)) -> Self {
impl Head {
pub fn new_at(grid: Rc<RefCell<Grid>>, coords: (isize, isize)) -> Self {
Self {
grid,
down: true,

4
src/main.rs

@ -1,5 +1,3 @@
#![feature(associated_type_bounds)]
pub mod grid;
pub mod head;
@ -11,7 +9,7 @@ use crate::head::Head;
use termion::{raw::IntoRawMode, input::TermRead, event::Key, cursor::Goto, color::{Black, Bg, AnsiValue}};
fn draw_grid_with_head(grid: &Grid, head: &Head<Rc<RefCell<Grid>>>) {
fn draw_grid_with_head(grid: &Grid, head: &Head) {
let mut s = String::new();
let mut bg_on = false;
let vb = head.visibility_box();

Loading…
Cancel
Save