https://github.com/ellisonch/rust-stopwatch
A stopwatch library for Rust. Used to time things.
https://github.com/ellisonch/rust-stopwatch
rust rust-stopwatch stopwatch timing
Last synced: about 1 month ago
JSON representation
A stopwatch library for Rust. Used to time things.
- Host: GitHub
- URL: https://github.com/ellisonch/rust-stopwatch
- Owner: ellisonch
- License: mit
- Created: 2014-12-30T23:20:13.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-01T15:22:01.000Z (over 2 years ago)
- Last Synced: 2024-04-30T08:31:22.284Z (12 months ago)
- Topics: rust, rust-stopwatch, stopwatch, timing
- Language: Rust
- Homepage:
- Size: 17.6 KB
- Stars: 80
- Watchers: 4
- Forks: 20
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-rust-cn - ellisonch/rust-stopwatch - ci.org/ellisonch/rust-stopwatch.svg?branch=master">](https://travis-ci.org/ellisonch/rust-stopwatch) (Development tools / Profiling)
- awesome-rust - ellisonch/rust-stopwatch - ci.org/ellisonch/rust-stopwatch.svg?branch=master">](https://travis-ci.org/ellisonch/rust-stopwatch) (Development tools / Profiling)
- awesome-rust - ellisonch/rust-stopwatch
- awesome-rust-cn - ellisonch/rust-stopwatch
- awesome-rust-zh - ellisonch/rust-stopwatch - 秒表库[<img src="https://api.travis-ci.org/ellisonch/rust-stopwatch.svg?branch=master">](https://travis-ci.org/ellisonch/rust-stopwatch) (开发工具 / 剖析)
- awesome-rust - ellisonch/rust-stopwatch - A stopwatch library (Development tools / Profiling)
- awesome-rust - ellisonch/rust-stopwatch - ci.org/ellisonch/rust-stopwatch.svg?branch=master">](https://travis-ci.org/ellisonch/rust-stopwatch) (开发工具 Development tools / 分析 Profiling)
- fucking-awesome-rust - ellisonch/rust-stopwatch - A stopwatch library (Development tools / Profiling)
README
# rust-stopwatch
This is a simple module used to time things in Rust.[](https://travis-ci.org/ellisonch/rust-stopwatch)
## Usage
To use, add the following line to `Cargo.toml` under `[dependencies]`:
```tomlstopwatch = "0.0.7"
```
or alternatively,
```toml
stopwatch = { git = "https://github.com/ellisonch/rust-stopwatch.git" }
```## Example
```rust
extern crate stopwatch;
use stopwatch::{Stopwatch};
// ...
let sw = Stopwatch::start_new();
// do something that takes some time
println!("Thing took {}ms", sw.elapsed_ms());
```## Methods
```rust
fn new() -> Stopwatch
fn start_new() -> Stopwatch
fn start(&mut self)
fn stop(&mut self)
fn reset(&mut self)
fn restart(&mut self)
fn is_running(&self) -> bool
fn elapsed(&self) -> Duration
fn elapsed_ms(&self) -> i64
```