pub struct HeadlessEventSource { /* private fields */ }Expand description
A no-op event source for headless and test programs.
Returns a fixed terminal size, accepts feature changes silently, and never
produces events. This allows the test helper to construct a Program
without depending on crossterm or a real terminal.
Implementations§
Source§impl HeadlessEventSource
impl HeadlessEventSource
Sourcepub fn new(width: u16, height: u16, features: BackendFeatures) -> Self
pub fn new(width: u16, height: u16, features: BackendFeatures) -> Self
Create a headless event source with the given terminal size.
Trait Implementations§
Source§impl BackendEventSource for HeadlessEventSource
impl BackendEventSource for HeadlessEventSource
Source§fn size(&self) -> Result<(u16, u16), Error>
fn size(&self) -> Result<(u16, u16), Error>
Query current terminal dimensions (columns, rows).
Source§fn set_features(&mut self, features: BackendFeatures) -> Result<(), Error>
fn set_features(&mut self, features: BackendFeatures) -> Result<(), Error>
Enable or disable terminal features (mouse, paste, focus, kitty keyboard). Read more
Source§fn poll_event(&mut self, _timeout: Duration) -> Result<bool, Error>
fn poll_event(&mut self, _timeout: Duration) -> Result<bool, Error>
Poll for an available event, returning
true if one is ready. Read moreSource§fn read_event(&mut self) -> Result<Option<Event>, Error>
fn read_event(&mut self) -> Result<Option<Event>, Error>
Read the next available event, or
None if none is ready. Read moreSource§fn supports_suspend(&self) -> bool
fn supports_suspend(&self) -> bool
Whether
suspend can hand the terminal back for a
job-control stop. The runtime claims SIGTSTP/SIGTTIN/SIGTTOU only for a
source that says so; others keep the signals’ default action.Auto Trait Implementations§
impl Forget for HeadlessEventSource
impl Freeze for HeadlessEventSource
impl Move for HeadlessEventSource
impl RefUnwindSafe for HeadlessEventSource
impl Send for HeadlessEventSource
impl Sync for HeadlessEventSource
impl Unpin for HeadlessEventSource
impl UnsafeUnpin for HeadlessEventSource
impl UnwindSafe for HeadlessEventSource
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