Struct tty_interface::Interface
source · [−]pub struct Interface<'a> { /* private fields */ }Expand description
A TTY-based user-interface providing optimized update rendering.
Implementations
sourceimpl Interface<'_>
impl Interface<'_>
sourcepub fn new<'a>(device: &'a mut dyn Device) -> Result<Interface<'a>>
pub fn new<'a>(device: &'a mut dyn Device) -> Result<Interface<'a>>
Create a new interface for the specified device.
Examples
use tty_interface::Interface;
let interface = Interface::new(&mut device)?;sourcepub fn exit(self) -> Result<()>
pub fn exit(self) -> Result<()>
When finished using this interface, uninitialize its terminal configuration.
Examples
use tty_interface::Interface;
let interface = Interface::new(&mut device)?;
interface.exit()?;sourcepub fn set(&mut self, position: Position, text: &str)
pub fn set(&mut self, position: Position, text: &str)
Update the interface’s text at the specified position. Changes are staged until applied.
Examples
use tty_interface::{Interface, Position, pos};
let mut interface = Interface::new(&mut device)?;
interface.set(pos!(1, 1), "Hello, world!");sourcepub fn set_styled(&mut self, position: Position, text: &str, style: Style)
pub fn set_styled(&mut self, position: Position, text: &str, style: Style)
Update the interface’s text at the specified position. Changes are staged until applied.
Examples
use tty_interface::{Interface, Style, Position, pos};
let mut interface = Interface::new(&mut device)?;
interface.set_styled(pos!(1, 1), "Hello, world!", Style::default().set_bold(true));Auto Trait Implementations
impl<'a> !RefUnwindSafe for Interface<'a>
impl<'a> !Send for Interface<'a>
impl<'a> !Sync for Interface<'a>
impl<'a> Unpin for Interface<'a>
impl<'a> !UnwindSafe for Interface<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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