Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
museun committed Sep 25, 2020
2 parents 6a4cc6e + 468d990 commit 811ed63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mock_instant"
version = "0.2"
version = "0.2.0"
authors = ["museun <museun@outlook.com>"]
edition = "2018"
license = "0BSD"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

## mock_instant

This crate allows you to test Instant/Duration code, deterministically ***per thread***.
This crate allows you to test Instant/Duration code, deterministically **_per thread_**.

If cross-thread determinism is required, enable the `sync` feature:

```toml
mock_instant = { version = "0.2", features = ["sync"] }
```

It provides a replacement `std::time::Instant` that uses a deterministic thread-local 'clock'

You can swap out the `std::time::Instant` with this one by doing something similar to:

```rust
#[cfg(test)]
use mock_instant::Instant;
Expand All @@ -21,6 +23,7 @@ use std::time::Instant;
```

## Example

```rust
use std::time::Duration;

Expand Down

0 comments on commit 811ed63

Please sign in to comment.