Crate altio

source ·
Expand description

This crate helps to automating command tools by simulating piped io in process.

§Usage

[dependencies]
altio = { version = "0.2", default-features = false }

[features]
altio = ["altio/altio"]

§Why this crate

Interactive command tools utilize stdin, stdout and stderr for communication. If you want to use command tools as libraries(no spawning processes) and tool authors agree, this crate can help to automating input/output, just 3 steps:

  1. Define an Altio variable e.g. let io = Altio::default();.

  2. Replace std APIs with altio’s equivalents, e.g. replace println!(...) with writeln!( io.out(), ... ), replace std::io::stdin() with io.input().

  3. Keep main.rs as simple as possible, e.g. fn main() { the_tool::run( std::env::args_os() )}.

§License

Under Apache License 2.0 or MIT License, at your will.

Macros§

  • This macro writes formatted data into a buffer, or panic on failures.
  • Provides delegated out()/err() methods for the type which contains a field named altio.

Structs§

  • Corresponding to std::io::Stdin
  • Corresponding to std::io::StdinLock
  • Simulates a program’s Stdin,Stdout,Stderr.
  • Corresponding to std::io::Stdout
  • Corresponding to std::io::StdoutLock
  • Corresponding to std::io::Lines