Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 161 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ members = ["fastimer", "fastimer-driver", "fastimer-tokio", "xtask"]
resolver = "2"

[workspace.package]
edition = "2021"
edition = "2024"
homepage = "https://github.com/fast/fastimer"
license = "Apache-2.0"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion fastimer-driver/src/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

use std::collections::BinaryHeap;
use std::ops::ControlFlow;
use std::sync::Arc;
use std::sync::atomic;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;

Expand Down
4 changes: 2 additions & 2 deletions fastimer-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
use std::cmp;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::sync::atomic;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll;
use std::time::Duration;
use std::time::Instant;

use atomic_waker::AtomicWaker;
use crossbeam_queue::SegQueue;
use fastimer::make_instant_from_now;
use fastimer::MakeDelay;
use fastimer::make_instant_from_now;
use parking::Unparker;

mod heap;
Expand Down
10 changes: 6 additions & 4 deletions fastimer-driver/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ fn assert_duration_eq(actual: Duration, expected: Duration) {
fn test_binary_heap_driver() {
let (mut driver, context, shutdown) = binary_heap_driver();
let (tx, rx) = std::sync::mpsc::channel();
std::thread::spawn(move || loop {
if driver.turn().is_break() {
tx.send(()).unwrap();
break;
std::thread::spawn(move || {
loop {
if driver.turn().is_break() {
tx.send(()).unwrap();
break;
}
}
});

Expand Down
2 changes: 2 additions & 0 deletions fastimer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pin-project = { version = "1.1.9" }
log = { version = "0.4.22", features = ["kv"], optional = true }

[dev-dependencies]
log = { version = "0.4.22", features = ["kv"] }
logforth = { version = "0.24.0", features = ["colored"] }
tokio = { workspace = true, features = ["full"] }

[lints]
Expand Down
12 changes: 6 additions & 6 deletions fastimer/src/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
//
// [1] https://github.com/tokio-rs/tokio/blob/b8ac94ed/tokio/src/time/interval.rs

use std::future::poll_fn;
use std::future::Future;
use std::future::poll_fn;
use std::pin::Pin;
use std::task::ready;
use std::task::Context;
use std::task::Poll;
use std::task::ready;
use std::time::Duration;
use std::time::Instant;

use crate::far_future;
use crate::MakeDelay;
use crate::far_future;

/// Creates new [`Interval`] that yields with interval of `period`. The first
/// tick completes immediately. The default [`MissedTickBehavior`] is
Expand All @@ -49,8 +49,8 @@ use crate::MakeDelay;
/// use std::time::Duration;
/// use std::time::Instant;
///
/// use fastimer::interval;
/// use fastimer::MakeDelay;
/// use fastimer::interval;
///
/// struct TokioDelay;
/// impl MakeDelay for TokioDelay {
Expand Down Expand Up @@ -85,8 +85,8 @@ use crate::MakeDelay;
/// use std::time::Duration;
/// use std::time::Instant;
///
/// use fastimer::interval;
/// use fastimer::MakeDelay;
/// use fastimer::interval;
///
/// struct TokioDelay;
/// impl MakeDelay for TokioDelay {
Expand Down Expand Up @@ -139,8 +139,8 @@ pub fn interval<D: MakeDelay>(period: Duration, make_delay: D) -> Interval<D> {
/// use std::time::Duration;
/// use std::time::Instant;
///
/// use fastimer::interval_at;
/// use fastimer::MakeDelay;
/// use fastimer::interval_at;
///
/// struct TokioDelay;
/// impl MakeDelay for TokioDelay {
Expand Down
4 changes: 2 additions & 2 deletions fastimer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<T: MakeDelay> MakeDelayExt for T {}
pub(crate) use self::macros::debug;
pub(crate) use self::macros::info;

#[cfg(feature = "logging")]
#[cfg(any(test, feature = "logging"))]
mod macros {
macro_rules! debug {
(target: $target:expr, $($arg:tt)+) => (log::debug!(target: $target, $($arg)+));
Expand All @@ -146,7 +146,7 @@ mod macros {
pub(crate) use info;
}

#[cfg(not(feature = "logging"))]
#[cfg(not(any(test, feature = "logging")))]
#[macro_use]
mod macros {
macro_rules! info {
Expand Down
Loading