pub struct CoolInput<H: CustomInput> {
pub text: String,
pub cursor_x: usize,
pub cursor_y: usize,
pub scroll_x: usize,
pub scroll_y: usize,
pub listening: bool,
pub custom_input: H,
pub tab_width: usize,
}
Expand description
The main input type. Uses a custom input handler (a struct which implements CustomInput)
Fields§
§text: String
§cursor_x: usize
§cursor_y: usize
§scroll_x: usize
§scroll_y: usize
§listening: bool
§custom_input: H
§tab_width: usize
Implementations§
Source§impl<H: CustomInput> CoolInput<H>
impl<H: CustomInput> CoolInput<H>
pub fn new(handler: H, tab_width: usize) -> Self
Sourcepub fn get_terminal_size(&mut self) -> Result<(u16, u16), Error>
pub fn get_terminal_size(&mut self) -> Result<(u16, u16), Error>
Get the size of the terminal running the program
Sourcepub fn listen_quiet(&mut self) -> Result<(), Error>
pub fn listen_quiet(&mut self) -> Result<(), Error>
Start listening for key presses without preparing the terminal
Sourcepub fn pre_listen(&mut self) -> Result<(), Error>
pub fn pre_listen(&mut self) -> Result<(), Error>
Prepare the terminal for input
Sourcepub fn post_listen(&mut self) -> Result<(), Error>
pub fn post_listen(&mut self) -> Result<(), Error>
Restore the terminal after input is finished.
Auto Trait Implementations§
impl<H> Freeze for CoolInput<H>where
H: Freeze,
impl<H> RefUnwindSafe for CoolInput<H>where
H: RefUnwindSafe,
impl<H> Send for CoolInput<H>where
H: Send,
impl<H> Sync for CoolInput<H>where
H: Sync,
impl<H> Unpin for CoolInput<H>where
H: Unpin,
impl<H> UnwindSafe for CoolInput<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more