Skip to content

Commit

Permalink
Remove tokio02
Browse files Browse the repository at this point in the history
  • Loading branch information
DoumanAsh committed Dec 3, 2020
1 parent 070532a commit cdd16ef
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 435 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
rustup target add wasm32-unknown-unknown
cargo check --target wasm32-unknown-unknown
- name: Test with tokio 0.2
if: runner.os != 'Windows'
run: cargo test --features tokio02,stream

- name: Test with tokio 0.3
if: runner.os != 'Windows'
run: cargo test --features tokio03 -- --nocapture
Expand Down
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ default = []
std = []
# Enables C API wrapper for platform code.
c_wrapper = ["cc"]
# Enables usage of tokio 0.2
tokio02 = ["mio", "tokio_02", "nix", "std"]
# Enables usage of tokio 0.3
tokio03 = ["tokio_03", "nix", "std"]
# Enables Stream implementation
Expand All @@ -47,8 +45,6 @@ features = ["threadpoolapiset"]

[target.'cfg(any(target_os = "macos", target_os = "ios", unix))'.dependencies]
libc = { version = "0.2.60", default-features = false }
mio = { version = "0.6", optional = true }
tokio_02 = { package = "tokio", version = "0.2", default-features = false, optional = true, features = ["io-driver"] }
tokio_03 = { package = "tokio", version = "0.3.5", default-features = false, optional = true, features = ["net"] }

#kqueue needs nix
Expand All @@ -59,7 +55,6 @@ nix = { version = "0.19", optional = true }
wasm-bindgen = "0.2"

[dev-dependencies]
tokio_02 = { package = "tokio", version = "0.2", features = ["macros", "rt-core"] }
tokio_03 = { package = "tokio", version = "0.3.2", default-features = false, features = ["macros", "rt"] }

[build-dependencies.cc]
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![Rust](https://github.com/DoumanAsh/async-timer/workflows/Rust/badge.svg?branch=master)
[![Crates.io](https://img.shields.io/crates/v/async-timer.svg)](https://crates.io/crates/async-timer)
[![Documentation](https://docs.rs/async-timer/badge.svg)](https://docs.rs/crate/async-timer/)
[![dependency status](https://deps.rs/crate/async-timer/1.0.0-beta.5/status.svg)](https://deps.rs/crate/async-timer)
[![dependency status](https://deps.rs/crate/async-timer/1.0.0-beta.6/status.svg)](https://deps.rs/crate/async-timer)

Timer facilities for Rust's async story

Expand All @@ -18,9 +18,10 @@ give you the most accurate timers possible on unix platforms (See features.)

## Features

- `tokio02` - Enables event loop based timers using tokio 0.2, providing higher accuracy than regular callback based timers on Linux/BSD/Apple platforms
- `tokio03` - Enables event loop based timers using tokio 0.3, providing higher resolution timer as `tokio02`.
- `tokio03` - Enables event loop based timers using tokio 0.3, providing higher resolution timers on unix platforms.
- `c_wrapper` - Uses C shim to create bindings to platform API, which may be more reliable than `libc`.
- `std` - Enables usage of std types (e.g. Error)
- `stream` - Enables `Stream` implementation for `Interval`

## Examples

Expand Down
8 changes: 4 additions & 4 deletions src/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::timer::Platform as PlatformTimer;

///Periodic Timer
///
///On each completition, underlying timer is restarted and therefore `Future` can be polled once
///On each completion, underlying timer is restarted and therefore `Future` can be polled once
///more.
///
///## Usage
Expand All @@ -24,7 +24,7 @@ use crate::timer::Platform as PlatformTimer;
///
/// while times < 5 {
/// job().await;
/// interval.as_mut().await;
/// interval.wait().await;
/// times += 1;
/// }
///}
Expand Down Expand Up @@ -66,8 +66,8 @@ impl<T: Timer> Interval<T> {
}

#[inline(always)]
///Gets mutable reference
pub fn as_mut(&mut self) -> &mut Self {
///Returns future for next expiration.
pub fn wait<'a>(&'a mut self) -> impl Future<Output=()> + 'a {
self
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
//!
//! ## Features
//!
//! - `tokio02` - Enables event loop based timers using tokio 0.2, providing higher accuracy than regular callback based timers on Linux/BSD/Apple platforms.
//! - `tokio03` - Enables event loop based timers using tokio 0.3, providing higher resolution timer as `tokio02`.
//! - `tokio03` - Enables event loop based timers using tokio 0.3, providing higher resolution timers on unix platforms.
//! - `c_wrapper` - Uses C shim to create bindings to platform API, which may be more reliable than `libc`.
//! - `std` - Enables usage of std types (e.g. Error)
//! - `stream` - Enables `Stream` implementation for `Interval`
#![warn(missing_docs)]

#![no_std]
Expand Down
184 changes: 0 additions & 184 deletions src/timer/kqueue.rs

This file was deleted.

19 changes: 2 additions & 17 deletions src/timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,39 +147,24 @@ pub use async_tokio03::AsyncTimer;
///Timer based on tokio's `AsyncFd`
pub type Platform = AsyncTimer;

#[cfg(all(feature = "tokio02", any(target_os = "linux", target_os = "android")))]
mod timer_fd;
#[cfg(all(feature = "tokio02", any(target_os = "linux", target_os = "android")))]
pub use timer_fd::TimerFd;

#[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))]
mod posix;
#[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))]
pub use posix::PosixTimer;
#[cfg(all(not(feature = "tokio02"), not(feature = "tokio03"), not(any(target_os = "macos", target_os = "ios")), unix))]
#[cfg(all(not(feature = "tokio03"), not(any(target_os = "macos", target_os = "ios")), unix))]
///Platform alias to POSIX timer
pub type Platform = posix::PosixTimer;
#[cfg(all(feature = "tokio02", any(target_os = "linux", target_os = "android")))]
///Platform alias to Linux `timerfd` Timer
pub type Platform = timer_fd::TimerFd;
#[cfg(all(unix, not(any(target_os = "macos", target_os = "ios"))))]
///Platform alias to POSIX Timer
pub type SyncPlatform = posix::PosixTimer;

#[cfg(all(feature = "tokio02", any(target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")))]
mod kqueue;
#[cfg(all(feature = "tokio02", any(target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")))]
pub use kqueue::KqueueTimer;
#[cfg(any(target_os = "macos", target_os = "ios"))]
mod apple;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub use apple::AppleTimer;
#[cfg(all(not(feature = "tokio02"), not(feature = "tokio03"), any(target_os = "macos", target_os = "ios")))]
#[cfg(all(not(feature = "tokio03"), any(target_os = "macos", target_os = "ios")))]
///Platform alias to Apple Dispatch timer
pub type Platform = apple::AppleTimer;
#[cfg(all(feature = "tokio02", any(target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")))]
///Platform Alias to `kqueue` based Timer
pub type Platform = kqueue::KqueueTimer;
#[cfg(any(target_os = "macos", target_os = "ios"))]
///Platform Alias to `kqueue` based Timer
pub type SyncPlatform = apple::AppleTimer;
Expand Down
Loading

0 comments on commit cdd16ef

Please sign in to comment.