Cinner (pronounced "Sinner") is an utility to write I/O operation in C++ style
It features C++ like style for cin
and cout
Why?
-
Because I'm bored of writing
std::io::stdin().read_line(&mut holder).trim().parse::<T>()
andprintln!("{}", <variable>)
all the time -
Because I didn't find any other library that does this
-
Because I didn't have anything to do
-
Because
I'm a C++ programmerI like C++ style
Also, I wanted to learn more "advanced" Rust lmao
I learnt:
-
Operator overloading
withtraits
(I'm still not sure if I did it right) -
The importance of
.trim()
(I forgot to add it in the first version and it took >5hrs to find the bug) -
Using
trait bounds
ingeneric functions
-
Variadics
(they're so cool) -
Publishing crates to
crates.io
Usage
- Add
cinner = "<version-no>"
to yourCargo.toml
file
You can use:
use ;
As opposed to:
Also it's recursive, so you can do:
use ;
If you have any suggestions, DCDA
Updates
- Cinner now supports "endl" functionality
© 2022 Sarad (Chronos Ltd.)