{"id":33922355,"url":"https://github.com/kunalsinghdadhwal/hemera","last_synced_at":"2026-03-11T04:30:57.380Z","repository":{"id":323322710,"uuid":"1092720110","full_name":"kunalsinghdadhwal/hemera","owner":"kunalsinghdadhwal","description":"Lightweight, zero-overhead procedural macro for precise function execution timing in Rust supports sync/async for effortless performance insights.","archived":false,"fork":false,"pushed_at":"2025-11-11T17:38:59.000Z","size":112,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-13T15:26:30.204Z","etag":null,"topics":["proc-macro","rust","tracing"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/hemera","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kunalsinghdadhwal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-09T06:56:46.000Z","updated_at":"2025-12-05T06:01:36.000Z","dependencies_parsed_at":"2025-11-09T15:04:35.495Z","dependency_job_id":null,"html_url":"https://github.com/kunalsinghdadhwal/hemera","commit_stats":null,"previous_names":["kunalsinghdadhwal/hemera"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kunalsinghdadhwal/hemera","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalsinghdadhwal%2Fhemera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalsinghdadhwal%2Fhemera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalsinghdadhwal%2Fhemera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalsinghdadhwal%2Fhemera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kunalsinghdadhwal","download_url":"https://codeload.github.com/kunalsinghdadhwal/hemera/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalsinghdadhwal%2Fhemera/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30370797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proc-macro","rust","tracing"],"created_at":"2025-12-12T09:00:52.480Z","updated_at":"2026-03-11T04:30:57.348Z","avatar_url":"https://github.com/kunalsinghdadhwal.png","language":"Rust","readme":"# Hemera\n\n[![Crates.io](https://img.shields.io/crates/v/hemera.svg)](https://crates.io/crates/hemera)\n[![Documentation](https://docs.rs/hemera/badge.svg)](https://docs.rs/hemera)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/kunalsinghdadhwal/hemera/blob/main/LICENSE)\n[![CI](https://github.com/kunalsinghdadhwal/hemera/workflows/CI/badge.svg)](https://github.com/kunalsinghdadhwal/hemera/actions)\n\n**Inevitable timing for Rust functions measure execution with divine precision.**\n\nHemera is a lightweight, zero-overhead procedural macro for measuring function execution time in Rust. Named after the Greek primordial goddess of the day, Hemera brings clarity and insight to your code's performance characteristics.\n\n## Features\n\n- **Zero-cost abstraction**: Minimal runtime overhead (~36 nanoseconds)\n- **Sync \u0026 Async support**: Works seamlessly with both synchronous and asynchronous functions\n- **Flexible logging**: Choose between `println!` and `eprintln!`\n- **Conditional logging**: Set thresholds to only log slow executions\n- **Custom labels**: Override function names in logs\n- **Tracing integration**: Optional support for the `tracing` ecosystem\n- **Generics support**: Works with generic functions and lifetimes\n- **Easy to use**: Just add `#[measure_time]` to any function\n\n## Installation\n\nAdd Hemera to your `Cargo.toml`:\n\n```bash\ncargo add hemera\n```\n\nOr manually:\n\n```toml\n[dependencies]\nhemera = \"0.1\"\n```\n\nFor tracing integration:\n\n```toml\n[dependencies]\nhemera = { version = \"0.1\", features = [\"tracing\"] }\n```\n\n## Usage\n\n### Basic Example\n\n```rust\nuse hemera::measure_time;\n\n#[measure_time]\nfn calculate_fibonacci(n: u32) -\u003e u32 {\n    if n \u003c= 1 {\n        n\n    } else {\n        calculate_fibonacci(n - 1) + calculate_fibonacci(n - 2)\n    }\n}\n\nfn main() {\n    let result = calculate_fibonacci(10);\n    // Output: [TIMING] Function 'calculate_fibonacci' executed in 23.456µs\n}\n```\n\n### Async Functions\n\n```rust\nuse hemera::measure_time;\n\n#[measure_time]\nasync fn fetch_data() -\u003e Result\u003cString, Box\u003cdyn std::error::Error\u003e\u003e {\n    // Your async code here\n    Ok(\"data\".to_string())\n}\n\n#[tokio::main]\nasync fn main() {\n    let data = fetch_data().await.unwrap();\n    // Output: [TIMING] Function 'fetch_data' executed in 1.234ms\n}\n```\n\n### Custom Name\n\n```rust\n#[measure_time(name = \"DatabaseQuery\")]\nfn query_users() -\u003e Vec\u003cUser\u003e {\n    // Your code here\n}\n// Output: [TIMING] Function 'DatabaseQuery' executed in 45.678ms\n```\n\n### Debug Level Logging\n\nUse `eprintln!` instead of `println!`:\n\n```rust\n#[measure_time(level = \"debug\")]\nfn debug_operation() {\n    // Your code here\n}\n```\n\n### Threshold-based Logging\n\nOnly log if execution time exceeds a threshold:\n\n```rust\n#[measure_time(threshold = \"10ms\")]\nfn maybe_slow_operation() {\n    // Only logs if this takes more than 10ms\n}\n```\n\nSupported units: `s` (seconds), `ms` (milliseconds), `us` (microseconds), `ns` (nanoseconds)\n\n### Combine All Options\n\n```rust\n#[measure_time(name = \"CriticalOperation\", level = \"debug\", threshold = \"100ms\")]\nasync fn critical_operation() -\u003e Result\u003c(), Error\u003e {\n    // Your code here\n}\n```\n\n### Generics Support\n\nHemera works seamlessly with generic functions:\n\n```rust\n#[measure_time]\nfn process\u003cT: Clone\u003e(value: T) -\u003e T {\n    value.clone()\n}\n\n#[measure_time(name = \"GenericAsync\")]\nasync fn async_process\u003cT: Send\u003e(value: T) -\u003e T {\n    value\n}\n```\n\n## Configuration Options\n\n| Attribute | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `name` | `String` | Function name | Custom label for the function in logs |\n| `level` | `\"info\"` \\| `\"debug\"` | `\"info\"` | Log level (`info` uses `println!`, `debug` uses `eprintln!`) |\n| `threshold` | `String` | None | Minimum duration to log (e.g., `\"10ms\"`, `\"1s\"`) |\n\n## Feature Flags\n\n| Feature | Description |\n|---------|-------------|\n| `tracing` | Enable integration with the `tracing` crate |\n\n### Using with Tracing\n\n```toml\n[dependencies]\nhemera = { version = \"0.1\", features = [\"tracing\"] }\ntracing = \"0.1\"\n```\n\nWhen the `tracing` feature is enabled, Hemera automatically creates tracing spans around your functions.\n\n## Roadmap\n\n| Feature | Status |\n|---------|--------|\n| Sync functions | Complete |\n| Async functions | Complete |\n| Threshold filtering | Complete |\n| Custom naming | Complete |\n| Debug/Info levels | Complete |\n| Tracing integration | Complete |\n| Block-level measurement | Planned |\n| Statistical aggregation | Planned |\n| Custom output formatters | Planned |\n\n## Examples\n\nCheck out the [examples](examples/) directory for more usage examples:\n\n- [`basic.rs`](examples/basic.rs) - Synchronous function examples\n- [`async_example.rs`](examples/async_example.rs) - Async function examples\n\nRun examples with:\n\n```bash\ncargo run --example basic\ncargo run --example async_example\n```\n\n## Benchmarks\n\nRun benchmarks to measure the macro's overhead:\n\n```bash\ncargo bench\n```\n\nBenchmark results are saved as HTML reports in `target/criterion/`. Open `target/criterion/report/index.html` in your browser to view detailed performance analysis with charts and statistics.\n\n## Testing\n\nRun the test suite:\n\n```bash\n# Run all tests\ncargo test --all-features\n\n# Run tests without features\ncargo test --no-default-features\n\n# Run with tracing feature\ncargo test --features tracing\n```\n\n---\n\n**Author:** [Kunal Singh Dadhwal](https://github.com/kunalsinghdadhwal)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalsinghdadhwal%2Fhemera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunalsinghdadhwal%2Fhemera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalsinghdadhwal%2Fhemera/lists"}