q-debug

Crates.ioq-debug
lib.rsq-debug
version0.1.1
sourcesrc
created_at2020-07-24 19:30:23.666325
updated_at2020-07-25 06:27:01.704974
descriptionQuick and dirty debugging for tired Rust programmers
homepagehttps://github.com/SteadBytes/q-rs
repositoryhttps://github.com/SteadBytes/q-rs
max_upload_size
id269207
size26,989
Ben Steadman (SteadBytes)

documentation

README

q

Crates.io

Quick and dirty debugging for tired Rust programmers.

Example Usage

examples/simple.rs

#[macro_use]
extern crate q_debug;

fn hello(name: &str) -> String {
    q!(name);
    format!("Hello, {}!", name)
}

fn main() {
    // No message
    q!();

    // Identifier
    let name = "SteadBytes";
    q!(name);

    // Returns expression values
    let greeting = q!(hello(name));
    q!(greeting);

    q!(Some(42));
}

Running the above using cargo run --example simple writes the following to $TMP_DIR/q (/tmp/q on Linux):

[19:13:49 ThreadId(1) examples/simple.rs simple::main:11]
>
> name = "SteadBytes"
[19:13:49 ThreadId(1) examples/simple.rs simple::hello:5]
> name = "SteadBytes"
[19:13:49 ThreadId(1) examples/simple.rs simple::main:18]
> hello(name) = "Hello, SteadBytes!"
> greeting = "Hello, SteadBytes!"
> Some(42) = Some(42)

A header line is logged at a regular (configurable) interval or if the calling function or module has changed.

Expression values are returned by q invocations.

Inspired by

Why is this crate called q-debug and not q?

q is unfortunately taken already (though I'm not sure what it is...).

Commit count: 12

cargo fmt