#language #input #higher-level #terminal #automatic #learning #stdout

sol_readln

一个简单替代Rust标准库中从终端读取输入的方法。(适用于学习和来自高级语言的人。)

1个稳定版本

1.0.1 2022年7月11日

#39 in #higher-level

MIT授权

4KB

SOL_READLN

一个简单替代Rust标准库从终端读取输入的方法+一个自动刷新stdout的打印函数,就像在其他语言中一样。

(适用于学习和来自高级语言的人。)

用法

use sol_readln::*;

fn main() {
    /// Prompts the user (terminal) for input, returns it as a String.
    /// Panics if it could not read it.
    let input = readln();

    /// Prompts the user (terminal) for input and returns a Result.
    /// Ok(input) where input is a String or
    /// Err(error) where error is a std::io::error:Error.
    let input = read_line();

    /// Prints and flushes the stdout, will panic if it isn't possible.
    /// Simple higher-level alternative, works as expected in other
    /// higher-level languages.
    print("Hello, sol!");
}

无运行时依赖