[−][src]Struct nixterm::term::Term
Fields
info: TermInfoBuf
Methods
impl Term<Stdin, Stdout>
[src]
impl<I, O> Term<I, O> where
I: Read + AsRawFd,
O: Write + AsRawFd,
[src]
I: Read + AsRawFd,
O: Write + AsRawFd,
Term represents the user's terminal.
It has two channels, I
(input), and O
(output).
Each terminal is accompanied by a "terminfo" file, (represented by the TermInfoBuf
struct).
pub fn from_streams(tib: TermInfoBuf, stdin: I, stdout: O) -> Term<I, O>
[src]
ⓘImportant traits for TermWriter<'a, O>pub fn writer<'a>(&'a self) -> TermWriter<'a, O>
[src]
ⓘImportant traits for TermWriter<'a, O>
Write to the terminal's stdout, it returns the number of bytes written.
write
does not need a mutable reference to self
, meaning it can be used while self is being borrowed,
however write
blocks if it's being called from another thread.
Examples
use nixterm::term::Term; pub fn main() { let term = Term::new().unwrap(); term.writer() .foreground("rgb(64, 64, 128)") .write(b" Look look look! I'm kinda blue now!\n") .flush() .err() .unwrap(); }
pub fn print<T: AsRef<str>>(&self, s: T) -> Result<usize>
[src]
pub fn println<T: AsRef<str>>(&self, s: T) -> Result<usize>
[src]
pub fn read(&self, buffer: &mut [u8]) -> usize
[src]
Read from the terminal's standard input. Read into a fixed length buffer and return the number of characters read.
Similar to Term::write
, read
does not need Term
to be mutable, however only one thread may be reading at a time.
Examples
use nixterm::term::Term; pub fn main() { let term = Term::new().unwrap(); let mut buffer : [u8; 12] = [0; 12]; // There's nothing to read! so read does nothing and returns 0. assert_eq!(term.read(&mut buffer), 0); assert_eq!(buffer, [0; 12]); }
pub fn readline(&self) -> Result<String>
[src]
pub fn err(&self) -> Result<()>
[src]
pub fn settings(&self) -> Settings
[src]
pub fn update(&self, settings: Settings) -> Result<()>
[src]
pub fn flush(&self)
[src]
ⓘImportant traits for Keys<'a, I, O>pub fn read_keys<'a>(&'a self) -> Keys<'a, I, O>
[src]
ⓘImportant traits for Keys<'a, I, O>
pub fn clear_line_after_cursor(&self)
[src]
pub fn save_cursor(&self)
[src]
pub fn restore_cursor(&self)
[src]
pub fn prompt<T: AsRef<str>>(&self, prompt: T) -> Result<String>
[src]
pub fn colors(&self) -> usize
[src]
Trait Implementations
Auto Trait Implementations
impl<I, O> Send for Term<I, O> where
I: Send,
O: Send,
I: Send,
O: Send,
impl<I, O> Unpin for Term<I, O> where
I: Unpin,
O: Unpin,
I: Unpin,
O: Unpin,
impl<I, O> !Sync for Term<I, O>
impl<I, O> !UnwindSafe for Term<I, O>
impl<I, O> !RefUnwindSafe for Term<I, O>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,