docstring, import, 2018 style (#211)

This commit is contained in:
Zrzka 2019-09-14 10:34:24 +02:00 committed by Timon
parent 10af72ba2a
commit 6c320b1c16
6 changed files with 23 additions and 17 deletions

View File

@ -1,8 +1,9 @@
use std::fmt::Display;
use std::io::Write;
#[cfg(windows)] #[cfg(windows)]
use crate::Result; use crate::Result;
use crate::{execute, impl_display, queue, write_cout}; use crate::{execute, impl_display, queue, write_cout};
use std::fmt::Display;
use std::io::Write;
/// A command is an action that can be performed on the terminal. /// A command is an action that can be performed on the terminal.
/// ///

View File

@ -5,14 +5,13 @@ extern crate libc;
#[cfg(windows)] #[cfg(windows)]
extern crate winapi; extern crate winapi;
pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand};
pub use self::error::{ErrorKind, Result};
#[cfg(windows)]
pub use self::functions::supports_ansi;
mod command; mod command;
pub mod error; pub mod error;
mod functions; mod functions;
pub mod macros; pub mod macros;
pub mod sys; pub mod sys;
pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand};
pub use self::error::{ErrorKind, Result};
#[cfg(windows)]
pub use self::functions::supports_ansi;

View File

@ -43,13 +43,15 @@ macro_rules! write_cout {
/// ///
/// # Example /// # Example
/// ```rust /// ```rust
/// use crossterm::{queue, Clear, Goto, ClearType}; ///
/// use std::io::{Write, stdout}; /// use std::io::{Write, stdout};
/// ///
/// use crossterm_utils::{queue, Output};
///
/// let mut stdout = stdout(); /// let mut stdout = stdout();
/// ///
/// // will be executed when flush is called /// // will be executed when flush is called
/// queue!(stdout, Goto(5, 5), Output("5,5".to_string())); /// queue!(stdout, Output("foo".to_string()));
/// ///
/// // some other code (no execution happening here) ... /// // some other code (no execution happening here) ...
/// ///
@ -121,13 +123,15 @@ macro_rules! queue {
/// ///
/// # Example /// # Example
/// ```rust /// ```rust
/// use crossterm::{Clear, Goto, ClearType}; /// use std::io::Write;
///
/// use crossterm_utils::{execute, Output};
/// ///
/// // will be executed directly /// // will be executed directly
/// execute!(std::io::stdout(), Goto(5, 5)); /// execute!(std::io::stdout(), Output("foo".to_string()));
/// ///
/// // will be executed directly /// // will be executed directly
/// execute!(std::io::stdout(), Goto(10, 10), Clear(ClearType::CurrentLine)); /// execute!(std::io::stdout(), Output("foo".to_string()), Output("bar".to_string()));
/// ``` /// ```
/// ///
/// # Remarks /// # Remarks

View File

@ -1,9 +1,9 @@
//! This module contains all `unix` specific terminal related logic. //! This module contains all `unix` specific terminal related logic.
pub use libc::{c_int, termios as Termios};
use std::{io, mem}; use std::{io, mem};
pub use libc::{c_int, termios as Termios};
static mut ORIGINAL_TERMINAL_MODE: Option<Termios> = None; static mut ORIGINAL_TERMINAL_MODE: Option<Termios> = None;
pub static mut RAW_MODE_ENABLED: bool = false; pub static mut RAW_MODE_ENABLED: bool = false;

View File

@ -1,8 +1,10 @@
pub mod ansi { pub mod ansi {
use crossterm_winapi::ConsoleMode;
use std::io; use std::io;
use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING; use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING;
use crossterm_winapi::ConsoleMode;
/// Toggle virtual terminal processing. /// Toggle virtual terminal processing.
/// ///
/// This method attempts to toggle virtual terminal processing for this /// This method attempts to toggle virtual terminal processing for this