3 stable releases

2.0.0 Oct 23, 2022
1.0.1 Sep 18, 2022

#1732 in Text processing

34 downloads per month

Custom license

7KB
96 lines

A simple crate to facilitate input and output within programs, with a set of macros. Example:

use quick_io::*;
use std::io::Write;

clear!();
addstr!("Input something: ");

addln!("You typed: {}.", getstr!());

getstr!();

down!(10);
right!(20);
addstr!("Went down 10 characters and right 20 characters"); 

getstr!();

addstr!(0, 10, "Moved to 0, 10 within addstr!");

getstr!(); 

mv!(0, 20);
addstr!("Moved to 0, 20 with mv!");

getstr!();

down!(20);
addln!("Press enter to clear this line.");

getstr!();

line_up!(2);
clear_line!();
line_down!(2);

addln!("Press enter to clear the entire screen.");

getstr!();

clear!();

Copypaste this into a main.rs for a demonstration of the crate (rust playground doesn't support input for some reason?) Note: Since this uses ANSI escape codes for clear!(), mv!(), etc. it may not work on some terminals/systems.


lib.rs:

A simple crate to facilitate input and output within programs, with a set of macros. Example:

use quick_io::*;

clear!();
addstr!("Input something: ");

println!("You typed: {}.", getstr!());

getstr!();

down!(10);
right!(20);
addstr!("Went down 10 characters and right 20 characters");

getstr!();

addstr!(0, 10, "Moved to 0, 10 within addstr!");

getstr!();

mv!(0, 20);
addstr!("Moved to 0, 20 with mv!");

getstr!();

down!(20);
addln!("Press enter to clear this line.");

getstr!();

line_up!(2);
clear_line!();
line_down!(2);

println!("Press enter to clear the entire screen.");

getstr!();

clear!();

Copypaste this into a main.rs for a demonstration of the crate (rust playground doesn't support input for some reason?) Note: Since this uses ANSI escape codes for clear!(), mv!(), etc. it may not work on some terminals/systems.

No runtime deps