This commit is contained in:
timon 2018-10-05 19:30:00 +02:00 committed by Timon
parent 4f92c0c24f
commit cb08b6b984
12 changed files with 23 additions and 23 deletions

View File

@ -21,7 +21,7 @@ pub fn pos() {
let screen = Screen::default();
let mut cursor = cursor(&screen);
// get the cursor position.
let (x, y) = cursor.pos();
let (_x, _y) = cursor.pos();
}
/// Move the cursor 3 up | demonstration.

View File

@ -21,7 +21,7 @@ pub fn read_async_until() {
let mut stdin = input.read_until_async(b'\r').bytes();
for i in 0..100 {
for _i in 0..100 {
terminal.clear(ClearType::All);
cursor.goto(1, 1);
let a = stdin.next();
@ -49,7 +49,7 @@ pub fn read_async() {
let mut stdin = input.read_async().bytes();
for i in 0..100 {
for _i in 0..100 {
let a = stdin.next();
println!("pressed key: {:?}", a);

View File

@ -35,7 +35,7 @@ fn main() {
{
input_buf.lock().unwrap().clear();
}
Some(Ok(val)) =>
Some(Ok(_val)) =>
{
input_buf.lock().unwrap().push(a.unwrap().unwrap() as char);
}
@ -65,7 +65,7 @@ fn log(input_buf: Arc<Mutex<String>>, screen: &Screen) -> Vec<thread::JoinHandle
for i in 0..1
{
let input_buffer = input_buf.clone();
let clone_stdout = screen.stdout.clone();
let _clone_stdout = screen.stdout.clone();
let crossterm = Crossterm::from(screen.stdout.clone());

View File

@ -82,14 +82,14 @@ fn new_sync_flag(initial_state: bool) -> (SyncFlagTx, SyncFlagRx) {
fn main()
{
let (results_tx, results_rx): (Sender<String>, Receiver<String>) = mpsc::channel();
let (_results_tx, _results_rx): (Sender<String>, Receiver<String>) = mpsc::channel();
let (mut more_jobs_tx, more_jobs_rx) = new_sync_flag(true);
// queue with all log entry's.
let queue = WorkQueue::new();
// queue x logs with different threads.
let thread_handles = log_with_different_threads(more_jobs_tx.clone(), queue.clone());
let _thread_handles = log_with_different_threads(more_jobs_tx.clone(), queue.clone());
// a thread that will log all logs in the queue.
handle_incoming_logs(more_jobs_rx.clone(), queue.clone());

View File

@ -12,10 +12,10 @@ pub fn use_crossterm_cursor()
let crossterm = Crossterm::new(&screen);
// pass a reference to the current screen.
let cursor = crossterm.cursor();
let color = crossterm.color();
let terminal = crossterm.terminal();
let style = crossterm.style("").with(Color::Black).on(Color::Green);
let _cursor = crossterm.cursor();
let _color = crossterm.color();
let _terminal = crossterm.terminal();
let _style = crossterm.style("").with(Color::Black).on(Color::Green);
// perform some actions with the instances above.
}

View File

@ -21,7 +21,7 @@ pub fn get_terminal_size() -> (u16, u16) {
}
/// Get the cursor position based on the current platform.
pub fn get_cursor_position(stdout: &Arc<TerminalOutput>) -> (u16, u16) {
pub fn get_cursor_position(_stdout: &Arc<TerminalOutput>) -> (u16, u16) {
#[cfg(unix)]
return pos().expect("Valide position");
// return pos().unwrap_or_else(|x| { return (0,0) });

View File

@ -32,7 +32,7 @@ impl RawScreen {
#[cfg(target_os = "windows")]
let mut command = win_commands::RawModeCommand::new();
let result = command.enable();
let _result = command.enable();
Ok(())
}

View File

@ -73,7 +73,7 @@ pub fn terminal_size() -> (u16, u16) {
pub fn pos() -> io::Result<(u16, u16)>
{
let screen = Screen::new(false);
let _screen = Screen::new(false);
// if we enable raw modes with screen, this could cause problems if raw mode is already enabled in applicaition.
// I am not completely happy with this approach so feel free to find an other way.
@ -226,7 +226,7 @@ pub fn disable_raw_mode() -> io::Result<()>
pub fn get_tty() -> io::Result<fs::File> {
let mut tty_f: fs::File = unsafe { ::std::mem::zeroed() };
let fd = unsafe {
let _fd = unsafe {
if libc::isatty(libc::STDIN_FILENO) == 1 {
libc::STDIN_FILENO
} else {

View File

@ -15,7 +15,7 @@ impl UnixInput {
}
impl ITerminalInput for UnixInput {
fn read_line(&self, screen_manger: &Arc<TerminalOutput>) -> io::Result<String> {
fn read_line(&self, _screen_manger: &Arc<TerminalOutput>) -> io::Result<String> {
let mut rv = String::new();
io::stdin().read_line(&mut rv)?;
let len = rv.trim_right_matches(&['\r', '\n'][..]).len();
@ -23,11 +23,11 @@ impl ITerminalInput for UnixInput {
Ok(rv)
}
fn read_char(&self, screen_manger: &Arc<TerminalOutput>) -> io::Result<char> {
fn read_char(&self, _screen_manger: &Arc<TerminalOutput>) -> io::Result<char> {
read_char()
}
fn read_async(&self, screen_manger: &Arc<TerminalOutput>) -> AsyncReader {
fn read_async(&self, _screen_manger: &Arc<TerminalOutput>) -> AsyncReader {
let (send, recv) = mpsc::channel();
thread::spawn(move || {
@ -41,7 +41,7 @@ impl ITerminalInput for UnixInput {
AsyncReader { recv: recv }
}
fn read_until_async(&self, delimiter: u8, screen_manger: &Arc<TerminalOutput>) -> AsyncReader {
fn read_until_async(&self, delimiter: u8, _screen_manger: &Arc<TerminalOutput>) -> AsyncReader {
let (send, recv) = mpsc::channel();
thread::spawn(move || {

View File

@ -36,7 +36,7 @@ mod winapi_tests {
#[test]
fn write_ansi()
{
let screen = Screen::default();
let _screen = Screen::default();
let output = AnsiOutput::new();
let bytes = "test".as_bytes();
@ -47,7 +47,7 @@ fn write_ansi()
#[test]
fn write_str_ansi()
{
let screen = Screen::default();
let _screen = Screen::default();
let output = AnsiOutput::new();
let bytes = "test".as_bytes();

View File

@ -216,7 +216,7 @@ impl <'a, D: Display + 'a> DisplayableObject<'a, D>
impl<'a, D: Display + 'a> Display for DisplayableObject<'a, D>
{
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
fn fmt(&self, _f: &mut Formatter) -> Result<(), Error> {
self.styled_object.paint(&self.screen);
return Ok(())
}

View File

@ -36,7 +36,7 @@ impl ITerminal for AnsiTerminal {
};
}
fn terminal_size(&self, stdout: &Arc<TerminalOutput>) -> (u16, u16) {
fn terminal_size(&self, _stdout: &Arc<TerminalOutput>) -> (u16, u16) {
functions::get_terminal_size()
}