feat: update outdated dependencies

pull/94/head
Florian Dehau 6 years ago
parent 5cee2afc6d
commit b3689eceb7

@ -27,11 +27,11 @@ unicode-segmentation = "1.2"
unicode-width = "0.1"
termion = { version = "1.5", optional = true }
rustbox = { version = "0.11", optional = true }
crossterm = { version = "0.4", optional = true }
crossterm = { version = "0.5", optional = true }
[dev-dependencies]
stderrlog = "0.4"
rand = "0.4"
rand = "0.6"
failure = "0.1"
[[example]]

@ -1,5 +1,4 @@
# Makefile for the tui-rs project (https://github.com/fdehau/tui-rs)
SHELL=/bin/bash
# ================================ Cargo ======================================
@ -72,7 +71,7 @@ build-examples: ## Build all examples
.PHONY: run-examples
run-examples: ## Run all examples
@for file in examples/*.rs; do \
name=$$(basename $${file//.rs/}); \
name=$$(basename $${file/.rs/}); \
$(CARGO) run --features=termion,crossterm --example $$name; \
done;

@ -47,7 +47,7 @@ fn main() -> Result<(), failure::Error> {
).render(&mut f, size);
})?;
let input = crossterm::input(terminal.backend().screen());
let input = crossterm::input();
match input.read_char()? {
'q' => {
break;

@ -2,18 +2,19 @@ extern crate rand;
pub mod event;
use self::rand::distributions::{IndependentSample, Range};
use self::rand::distributions::{Distribution, Uniform};
use self::rand::rngs::ThreadRng;
#[derive(Clone)]
pub struct RandomSignal {
range: Range<u64>,
rng: rand::ThreadRng,
distribution: Uniform<u64>,
rng: ThreadRng,
}
impl RandomSignal {
pub fn new(lower: u64, upper: u64) -> RandomSignal {
RandomSignal {
range: Range::new(lower, upper),
distribution: Uniform::new(lower, upper),
rng: rand::thread_rng(),
}
}
@ -22,7 +23,7 @@ impl RandomSignal {
impl Iterator for RandomSignal {
type Item = u64;
fn next(&mut self) -> Option<u64> {
Some(self.range.ind_sample(&mut self.rng))
Some(self.distribution.sample(&mut self.rng))
}
}

@ -25,25 +25,25 @@ impl CrosstermBackend {
impl Backend for CrosstermBackend {
fn clear(&mut self) -> io::Result<()> {
let terminal = crossterm::terminal::terminal(&self.screen);
let terminal = crossterm::terminal::terminal();
terminal.clear(crossterm::terminal::ClearType::All);
Ok(())
}
fn hide_cursor(&mut self) -> io::Result<()> {
let cursor = crossterm::cursor(&self.screen);
let cursor = crossterm::cursor();
cursor.hide();
Ok(())
}
fn show_cursor(&mut self) -> io::Result<()> {
let cursor = crossterm::cursor(&self.screen);
let cursor = crossterm::cursor();
cursor.show();
Ok(())
}
fn size(&self) -> io::Result<Rect> {
let terminal = crossterm::terminal::terminal(&self.screen);
let terminal = crossterm::terminal::terminal();
let (width, height) = terminal.terminal_size();
Ok(Rect::new(0, 0, width, height))
}
@ -56,7 +56,7 @@ impl Backend for CrosstermBackend {
where
I: Iterator<Item = (u16, u16, &'a Cell)>,
{
let cursor = crossterm::cursor(&self.screen);
let cursor = crossterm::cursor();
let mut last_y = 0;
let mut last_x = 0;
for (x, y, cell) in content {

Loading…
Cancel
Save