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§

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

Structs§

Altin
Corresponding to std::io::Stdin
AltinLock
Corresponding to std::io::StdinLock
Altio
Simulates a program’s Stdin,Stdout,Stderr.
Altout
Corresponding to std::io::Stdout
AltoutLock
Corresponding to std::io::StdoutLock
Lines
Corresponding to std::io::Lines