Struct ascii_forge::window::Supports
source · pub struct Supports { /* private fields */ }Expand description
Struct that helps report what the terminal supports for you without you having to work with it yourself.
Implementations§
source§impl Supports
impl Supports
sourcepub fn keyboard(&self) -> Result<()>
pub fn keyboard(&self) -> Result<()>
Examples found in repository?
examples/event_visualizer.rs (line 10)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fn main() -> Result<(), Box<dyn Error>> {
let mut event = Event::FocusGained;
let mut window = Window::init()?;
// Require the window to support kitty keyboard protocol
window.supports().keyboard()?;
loop {
window.update(Duration::ZERO)?;
if let Some(new_event) = window.event() {
event = new_event.clone();
}
render!(
window,
vec2(0, 20) => [ "To Quit, Press Ctrl + C".red() ],
vec2(0, 0) => [ format!("{:#?}", event).replace('\t', " ") ],
);
if window.key(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)) {
break;
}
}
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Supports
impl Send for Supports
impl Sync for Supports
impl Unpin for Supports
impl UnwindSafe for Supports
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