{"id":20390352,"url":"https://github.com/timvisee/took-rs","last_synced_at":"2026-05-28T20:31:12.609Z","repository":{"id":66230243,"uuid":"211941377","full_name":"timvisee/took-rs","owner":"timvisee","description":":watch: Easily measure \u0026 report elapsed time in Rust. https://gitlab.com/timvisee/took-rs","archived":false,"fork":false,"pushed_at":"2020-03-18T18:52:18.000Z","size":34,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-04T08:57:18.881Z","etag":null,"topics":["elapsed-time","hacktoberfest","rust","rust-library","stopwatch-library","time"],"latest_commit_sha":null,"homepage":"","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/timvisee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["timvisee"],"custom":["https://timvisee.com/donate"],"patreon":"timvisee","ko_fi":"timvisee"}},"created_at":"2019-09-30T19:40:43.000Z","updated_at":"2022-04-07T07:20:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"b60eb313-cce1-4e92-baf2-6ceb7dbb9db3","html_url":"https://github.com/timvisee/took-rs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/timvisee/took-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvisee%2Ftook-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvisee%2Ftook-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvisee%2Ftook-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvisee%2Ftook-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timvisee","download_url":"https://codeload.github.com/timvisee/took-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timvisee%2Ftook-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33626136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"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":["elapsed-time","hacktoberfest","rust","rust-library","stopwatch-library","time"],"created_at":"2024-11-15T03:24:29.803Z","updated_at":"2026-05-28T20:31:12.572Z","avatar_url":"https://github.com/timvisee.png","language":"Rust","funding_links":["https://github.com/sponsors/timvisee","https://timvisee.com/donate","https://patreon.com/timvisee","https://ko-fi.com/timvisee"],"categories":[],"sub_categories":[],"readme":"[![Build status on GitLab CI][gitlab-ci-master-badge]][gitlab-ci-link]\n[![Newest release on crates.io][crate-version-badge]][crate-link]\n[![Documentation][docs-badge]][docs]\n[![Number of downloads on crates.io][crate-download-badge]][crate-link]\n[![Project license][crate-license-badge]](LICENSE)\n\n[crate-download-badge]: https://img.shields.io/crates/d/took.svg\n[crate-license-badge]: https://img.shields.io/crates/l/took.svg\n[crate-link]: https://crates.io/crates/took\n[crate-version-badge]: https://img.shields.io/crates/v/took.svg\n[docs-badge]: https://docs.rs/took/badge.svg\n[docs]: https://docs.rs/took\n[gitlab-ci-link]: https://gitlab.com/timvisee/took-rs/pipelines\n[gitlab-ci-master-badge]: https://gitlab.com/timvisee/took-rs/badges/master/pipeline.svg\n\n# `took`: easily measure \u0026 report elapsed time\nI always find measuring and reporting run time of code it in a human readable\nformat troublesome.\n\nThis crate provides a few simple interfaces to do just that.\n\n## Examples\n- Measure \u0026 report manually using Timer stopwatch:\n\n  ```rust\n  use took::Timer;\n\n  let timer = Timer::new();\n  // Run heavy task\n  println!(\"Done! Took {}\", timer.took());\n\n  // Prints:\n  // Done! Took 1.00 s\n  ```\n\n- Measure a function, report manually:\n\n  ```rust\n  use took::took;\n\n  let (took, result) = took(|| {\n      // Run heavy task\n  });\n  println!(\"Done, took {}\", took);\n\n  // Prints:\n  // Done! Took 1.00 s\n  ```\n\n- Measure \u0026 report a function automatically using attribute:\n\n  ```rust\n  #[macro_use]\n  extern crate took_macro;\n\n  my_function();\n  other_function();\n\n  #[took]\n  pub fn my_function() {\n      // Run heavy task\n  }\n\n  #[took(description = \"Render finished,\")]\n  pub fn other_function() {\n      // Run heavy task\n  }\n\n  // Prints:\n  // my_function() took 1.00 s\n  // Render finished, took 1.00 s\n  ```\n\n## Requirements\n- Rust 1.33 or newer (with `std`)\n\n## Usage\nAdd the dependencies in your `Cargo.toml`. The `took-macro` dependency is only\nrequired if you'll be using the `#[took]` attribute macro.\n\n```Cargo.toml\n[dependencies]\ntook = \"0.1\"\ntook-macro = \"0.1\" # if using macros\n```\n\nImport and start using:\n\n```rust\nuse took::{Timer, took};\n\nlet timer = Timer::new();\nprintln!(\"Done! Took {}\", timer.took());\n\nlet (took, result) = took(|| {\n    // Run heavy task\n});\nprintln!(\"Done, took {}\", took);\n```\n\nIf you'll be using `#[took]` attribute macro, explicitly import it:\n\n```rust\n#[macro_use]\nextern crate took_macro;\n\n#[took]\npub fn function_one() {}\n\n#[took(description = \"Some heavy logic finished,\")]\npub fn function_two() {}\n```\n\n## TODO\n- Support `#[took]` attribute for almost anything\n  (function call, blocks, if-statements, ...)\n- Time formatting configurability\n- Use more precise timers\n- Print elapsed time to more than just `stderr`\n\n## License\nThis project is released under the MIT license.\nCheck out the [LICENSE](LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimvisee%2Ftook-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimvisee%2Ftook-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimvisee%2Ftook-rs/lists"}