7 releases (4 stable)

Uses new Rust 2024

new 1.1.0 May 12, 2025
1.0.2 May 11, 2025
0.3.0 May 11, 2025
0.2.0 May 11, 2025
0.1.0 May 11, 2025

#694 in Asynchronous

Download history 628/week @ 2025-05-07

628 downloads per month

MIT license

21KB
623 lines

C++ streams in Rust

Are you tired of annoying println! calls? Do you miss your glorious std::cout in Rust?

Examples

use cppstreams::*;

fn main() {
    Cout << "Hello, world!" << Endl;
}
use cppstreams::*;

fn main() {
    let mut a: i32 = Default::default();
    let mut b: i32 = Default::default();

    Cin >> &mut a;
    Cin >> &mut b;

    Cout << a << " + " << b << " = " << (a + b) << Endl;
}
use cppstreams::*;

fn main() {
    let mut str_stream = StringStream::default();

    &mut str_stream << "Hello";

    &mut str_stream << ',' << ' ';

    &mut str_stream << "world!";

    Cout << str_stream << Endl;
}
use cppstreams::*;

fn main() {
    let data = vec![1, 2, 3, 4];

    // use Debug trait
    Cout << debug!(data) << Endl;

    // complex formatting
    Cout << formatted!("{data:#?}") << Endl;
}

No runtime deps