pub struct UnixTerminal { /* private fields */ }
Expand description
A unix style terminal
Implementations
sourceimpl UnixTerminal
impl UnixTerminal
sourcepub fn new_from_stdio(caps: Capabilities) -> Result<UnixTerminal>
pub fn new_from_stdio(caps: Capabilities) -> Result<UnixTerminal>
Attempt to create an instance from the stdin and stdout of the process. This will fail unless both are associated with a tty. Note that this will duplicate the underlying file descriptors and will no longer participate in the stdin/stdout locking provided by the rust standard library.
pub fn new_with<A: AsRawFd, B: AsRawFd>(
caps: Capabilities,
read: &A,
write: &B
) -> Result<UnixTerminal>
sourcepub fn new(caps: Capabilities) -> Result<UnixTerminal>
pub fn new(caps: Capabilities) -> Result<UnixTerminal>
Attempt to explicitly open a handle to the terminal device
(/dev/tty) and build a UnixTerminal
from there. This will
yield a terminal even if the stdio streams have been redirected,
provided that the process has an associated controlling terminal.
Trait Implementations
sourceimpl Drop for UnixTerminal
impl Drop for UnixTerminal
sourceimpl Terminal for UnixTerminal
impl Terminal for UnixTerminal
sourcefn set_raw_mode(&mut self) -> Result<()>
fn set_raw_mode(&mut self) -> Result<()>
Raw mode disables input line buffering, allowing data to be read as the user presses keys, disables local echo, so keys pressed by the user do not implicitly render to the terminal output, and disables canonicalization of unix newlines to CRLF. Read more
fn set_cooked_mode(&mut self) -> Result<()>
sourcefn enter_alternate_screen(&mut self) -> Result<()>
fn enter_alternate_screen(&mut self) -> Result<()>
Enter the alternate screen. The alternate screen will be left
automatically when the Terminal
is dropped. Read more
sourcefn exit_alternate_screen(&mut self) -> Result<()>
fn exit_alternate_screen(&mut self) -> Result<()>
Exit the alternate screen.
sourcefn get_screen_size(&mut self) -> Result<ScreenSize>
fn get_screen_size(&mut self) -> Result<ScreenSize>
Queries the current screen size, returning width, height.
sourcefn set_screen_size(&mut self, size: ScreenSize) -> Result<()>
fn set_screen_size(&mut self, size: ScreenSize) -> Result<()>
Sets the current screen size
sourcefn render(&mut self, changes: &[Change]) -> Result<()>
fn render(&mut self, changes: &[Change]) -> Result<()>
Render a series of changes to the terminal output
sourcefn poll_input(&mut self, wait: Option<Duration>) -> Result<Option<InputEvent>>
fn poll_input(&mut self, wait: Option<Duration>) -> Result<Option<InputEvent>>
Check for a parsed input event.
wait
indicates the behavior in the case that no input is
immediately available. If wait is None
then poll_input
will not return until an event is available. If wait is
Some(duration)
then poll_input
will wait up to the given
duration for an event before returning with a value of
Ok(None)
. If wait is Some(Duration::ZERO)
then the
poll is non-blocking. Read more
fn waker(&self) -> UnixTerminalWaker
Auto Trait Implementations
impl RefUnwindSafe for UnixTerminal
impl Send for UnixTerminal
impl Sync for UnixTerminal
impl Unpin for UnixTerminal
impl UnwindSafe for UnixTerminal
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more