Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steadbytes/q-rs
Quick and dirty debugging for tired Rust programmers.
https://github.com/steadbytes/q-rs
Last synced: 6 days ago
JSON representation
Quick and dirty debugging for tired Rust programmers.
- Host: GitHub
- URL: https://github.com/steadbytes/q-rs
- Owner: SteadBytes
- License: mit
- Created: 2020-07-04T17:18:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-25T06:30:06.000Z (over 4 years ago)
- Last Synced: 2024-12-17T05:57:15.156Z (7 days ago)
- Language: Rust
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# q
[![Crates.io](https://img.shields.io/crates/v/q-debug)](https://crates.io/crates/q-debug)
Quick and dirty debugging for tired Rust programmers.
## Example Usage
[`examples/simple.rs`](examples/simple.rs)
```rust
#[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
- [`q` for Python](https://github.com/zestyping/q)
- [`q` for Golang](https://github.com/ryboe/q)## Why is this crate called `q-debug` and not `q`?
`q` is unfortunately [taken already](https://crates.io/crates/q) (though I'm not
sure what it is...).