Skip to content

Commit

Permalink
update crossterm from 0.23.2 to 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy8625 committed May 11, 2024
1 parent ba4eb67 commit c711869
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["command-line-utilities"]

[dependencies]
clap = { version = "3.1.18", features = ["cargo"] }
crossterm = "0.23.2"
crossterm = "0.27.0"
rand = "0.8.5"
itertools = "0.10.3"
ezemoji = "0.2.0"
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod user_input;
mod user_settings;

// None Standard Crates
use crossterm::{cursor, execute, queue, style, terminal, Result};
use crossterm::{cursor, execute, queue, style, terminal};
use rand::{thread_rng, Rng};

// Standard Library Crates
Expand Down Expand Up @@ -47,7 +47,7 @@ impl App {
user_settings,
}
}
fn run(&mut self) -> Result<()> {
fn run(&mut self) -> std::io::Result<()> {
let (width, height) = match self.user_settings.direction {
Direction::Left | Direction::Right => {
let (w, h) = terminal::size()?;
Expand Down Expand Up @@ -93,7 +93,7 @@ impl Drop for App {
}
}

fn main() -> Result<()> {
fn main() -> std::io::Result<()> {
let user_settings = cargs();
App::new(user_settings).run()
}
11 changes: 8 additions & 3 deletions src/term.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
use crate::{cursor, queue, style, terminal, Direction, Rain, Result, Stdout};
use crate::{cursor, queue, style, terminal, Direction, Rain, Stdout};

pub fn clear(w: &mut Stdout) -> Result<()> {
pub fn clear(w: &mut Stdout) -> std::io::Result<()> {
queue!(w, terminal::Clear(terminal::ClearType::All))?;
Ok(())
}

// TODO: Clean this crap up
// Draw takes rain data and places it on screen.
pub fn draw(w: &mut Stdout, rain: &Rain, spacing: u16, direction: &Direction) -> Result<()> {
pub fn draw(
w: &mut Stdout,
rain: &Rain,
spacing: u16,
direction: &Direction,
) -> std::io::Result<()> {
// NOTE: Maybe move this into its own functions to be generated at startup
// to lessen the amount of branching done.
// Further investigation into the assembly code to see if this is worth it.
Expand Down
4 changes: 2 additions & 2 deletions src/user_input.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{clear, Rain, Result, UserSettings};
use crate::{clear, Rain, UserSettings};
use crossterm::{event, style};
use std::io::Stdout;
use std::time::Duration;
Expand All @@ -7,7 +7,7 @@ pub fn user_input(
rain: &mut Rain,
user_settings: &UserSettings,
create_color: fn(style::Color, style::Color, u8) -> Vec<style::Color>,
) -> Result<bool> {
) -> std::io::Result<bool> {
if event::poll(Duration::from_millis(50))? {
match event::read()? {
event::Event::Key(keyevent) => {
Expand Down

0 comments on commit c711869

Please sign in to comment.