Struct kiro_editor::StdinRawMode[][src]

pub struct StdinRawMode { /* fields omitted */ }

Implementations

impl StdinRawMode[src]

pub fn new() -> Result<StdinRawMode>[src]

pub fn input_keys(self) -> InputSequences[src]

Methods from Deref<Target = Stdin>

pub fn lock(&self) -> StdinLock<'_>1.0.0[src]

Locks this handle to the standard input stream, returning a readable guard.

The lock is released when the returned lock goes out of scope. The returned guard also implements the Read and BufRead traits for accessing the underlying data.

Examples

use std::io::{self, Read};

fn main() -> io::Result<()> {
    let mut buffer = String::new();
    let stdin = io::stdin();
    let mut handle = stdin.lock();

    handle.read_to_string(&mut buffer)?;
    Ok(())
}

pub fn read_line(&self, buf: &mut String) -> Result<usize, Error>1.0.0[src]

Locks this handle and reads a line of input, appending it to the specified buffer.

For detailed semantics of this method, see the documentation on BufRead::read_line.

Examples

use std::io;

let mut input = String::new();
match io::stdin().read_line(&mut input) {
    Ok(n) => {
        println!("{} bytes read", n);
        println!("{}", input);
    }
    Err(error) => println!("error: {}", error),
}

You can run the example one of two ways:

  • Pipe some text to it, e.g., printf foo | path/to/executable
  • Give it text interactively by running the executable directly, in which case it will wait for the Enter key to be pressed before continuing

Trait Implementations

impl Deref for StdinRawMode[src]

type Target = Stdin

The resulting type after dereferencing.

impl DerefMut for StdinRawMode[src]

impl Drop for StdinRawMode[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.