shower

Crates.ioshower
lib.rsshower
version0.1.0
sourcesrc
created_at2023-07-01 15:49:45.638431
updated_at2023-07-01 15:49:45.638431
descriptionget string of code block
homepage
repositoryhttps://github.com/tiby312/shower
max_upload_size
id905585
size4,825
Ken Reed (tiby312)

documentation

README

Get the source code of a code block as a static string.

Example

fn main() {
    let (k, src) = shower::source!(|| {
        for i in 0..5 {
            println!("{}", i);
        }
        "{abc}"
    });

    // print the source code of the program
    println!("{}", src);

    println!("running program:");
    let k = k();

    println!("program returned={}", k);

}

Output

shower::source!(|| {
    for i in 0..5 {
        println!("{}", i);
    }
    "{abc}"
})
running program:
0
1
2
3
4
program returned={abc}
Commit count: 10

cargo fmt