simple-rate-limit

Crates.iosimple-rate-limit
lib.rssimple-rate-limit
version0.2.0
sourcesrc
created_at2020-08-11 09:46:01.543798
updated_at2020-08-15 07:52:56.522916
descriptionRate limit enforcement as simple data structures, no atomics.
homepagehttps://github.com/irrustible/simple-rate-limit
repositoryhttps://github.com/irrustible/simple-rate-limit
max_upload_size
id275311
size22,627
(jjl)

documentation

https://docs.rs/simple-rate-limit

README

simple-rate-limit

License Package Documentation

#[test]
fn one_nanosecond() {
    let rl = RateLimit::new(1, Duration::from_nanos(1)).unwrap();
    let mut rler = RateLimiter::new(rl);
    let then = Instant::now();
    assert_eq!(rler.check_at(then), true);
    let now = then + Duration::from_nanos(2);
    assert_eq!(rler.check_at(now), true);
}

Status

Beta? Only has basic tests but seems to work.

Copyright and License

Copyright (c) 2020 James Laver, simple-rate-limit contributors.

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Commit count: 4

cargo fmt