Skip to content

Commit

Permalink
bumpup version
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Oct 6, 2024
1 parent a617bb0 commit 1a5058c
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ jobs:
command: tarpaulin
args: --all-features --run-types tests --workspace --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
slug: ${{ github.repository }}
4 changes: 2 additions & 2 deletions agnostic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "agnostic"
version = "0.3.6"
version = "0.3.7"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
Expand Down Expand Up @@ -98,7 +98,7 @@ io = ["futures-util/io"]
# by enable this feature, TcpStream will implement
# both futures::AsyncRead/AsyncWrite and tokio::io::AsyncRead/AsyncWrite.
# But if you are using tokio, this feature can be ignored.
tokio-compat = ["tokio-util/compat", "dep:tokio"]
tokio-compat = ["tokio-util/compat", "dep:tokio", "net"]

tokio = [
"dep:tokio",
Expand Down
2 changes: 0 additions & 2 deletions agnostic/src/async_std/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use std::{

use ::async_std::net::{TcpListener, TcpStream, UdpSocket};
use futures_util::FutureExt;
#[cfg(feature = "compat")]
use tokio_util::compat::FuturesAsyncWriteCompatExt;

use crate::net::{Net, TcpStreamOwnedReadHalf, TcpStreamOwnedWriteHalf, ToSocketAddrs};

Expand Down
4 changes: 2 additions & 2 deletions agnostic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#![allow(clippy::needless_return)]
#![allow(unreachable_code)]

#[cfg(all(feature = "compat", not(feature = "net")))]
compile_error!("`compat` feature is enabled, but `net` feature is disabled, `compact` feature must only be enabled with `net` feature");
#[cfg(all(feature = "tokio-compat", not(feature = "net")))]
compile_error!("`tokio-compat` feature is enabled, but `net` feature is disabled, `tokio-compact` feature must only be enabled with `net` feature");

#[macro_use]
mod macros;
Expand Down
2 changes: 0 additions & 2 deletions agnostic/src/smol/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use std::{

use futures_util::FutureExt;
use smol::net::{TcpListener, TcpStream, UdpSocket};
#[cfg(feature = "compat")]
use tokio_util::compat::FuturesAsyncWriteCompatExt;

use crate::net::{Net, TcpStreamOwnedReadHalf, TcpStreamOwnedWriteHalf, ToSocketAddrs};

Expand Down
2 changes: 1 addition & 1 deletion lite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "agnostic-lite"
version = "0.3.15"
version = "0.3.16"
edition.workspace = true
license.workspace = true
rust-version.workspace = true
Expand Down
33 changes: 26 additions & 7 deletions lite/src/async_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ impl Yielder for AsyncStdSpawner {
}

impl AsyncSpawner for AsyncStdSpawner {
type JoinHandle<F> = ::async_std::task::JoinHandle<F> where F: Send + 'static;
type JoinHandle<F>
= ::async_std::task::JoinHandle<F>
where
F: Send + 'static;

fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -42,7 +45,10 @@ impl AsyncSpawner for AsyncStdSpawner {
}

impl AsyncLocalSpawner for AsyncStdSpawner {
type JoinHandle<F> = ::async_std::task::JoinHandle<F> where F: 'static;
type JoinHandle<F>
= ::async_std::task::JoinHandle<F>
where
F: 'static;

fn spawn_local<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -54,7 +60,8 @@ impl AsyncLocalSpawner for AsyncStdSpawner {
}

impl AsyncBlockingSpawner for AsyncStdSpawner {
type JoinHandle<R> = ::async_std::task::JoinHandle<R>
type JoinHandle<R>
= ::async_std::task::JoinHandle<R>
where
R: Send + 'static;

Expand Down Expand Up @@ -96,13 +103,25 @@ impl super::RuntimeLite for AsyncStdRuntime {
#[cfg(feature = "time")]
type LocalSleep = AsyncIoSleep;
#[cfg(feature = "time")]
type Delay<F> = AsyncIoDelay<F> where F: Future + Send;
type Delay<F>
= AsyncIoDelay<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalDelay<F> = AsyncIoDelay<F> where F: Future;
type LocalDelay<F>
= AsyncIoDelay<F>
where
F: Future;
#[cfg(feature = "time")]
type Timeout<F> = AsyncIoTimeout<F> where F: Future + Send;
type Timeout<F>
= AsyncIoTimeout<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalTimeout<F> = AsyncIoTimeout<F> where F: Future;
type LocalTimeout<F>
= AsyncIoTimeout<F>
where
F: Future;

fn new() -> Self {
Self
Expand Down
14 changes: 8 additions & 6 deletions lite/src/async_std/after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,10 @@ where
impl AsyncAfterSpawner for AsyncStdSpawner {
type JoinError = Infallible;

type JoinHandle<F> = AsyncStdAfterHandle<F>
where
F: Send + 'static;
type JoinHandle<F>
= AsyncStdAfterHandle<F>
where
F: Send + 'static;

fn spawn_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -306,9 +307,10 @@ impl AsyncAfterSpawner for AsyncStdSpawner {

impl AsyncLocalAfterSpawner for AsyncStdSpawner {
type JoinError = Infallible;
type JoinHandle<F> = AsyncStdAfterHandle<F>
where
F: 'static;
type JoinHandle<F>
= AsyncStdAfterHandle<F>
where
F: 'static;

fn spawn_local_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand Down
33 changes: 26 additions & 7 deletions lite/src/smol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ impl Yielder for SmolSpawner {
}

impl AsyncSpawner for SmolSpawner {
type JoinHandle<F> = ::smol::Task<F> where F: Send + 'static;
type JoinHandle<F>
= ::smol::Task<F>
where
F: Send + 'static;

fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -52,7 +55,10 @@ impl AsyncSpawner for SmolSpawner {
}

impl AsyncLocalSpawner for SmolSpawner {
type JoinHandle<F> = ::smol::Task<F> where F: 'static;
type JoinHandle<F>
= ::smol::Task<F>
where
F: 'static;

fn spawn_local<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -72,7 +78,8 @@ impl AsyncLocalSpawner for SmolSpawner {
}

impl AsyncBlockingSpawner for SmolSpawner {
type JoinHandle<R> = ::smol::Task<R>
type JoinHandle<R>
= ::smol::Task<R>
where
R: Send + 'static;

Expand Down Expand Up @@ -122,13 +129,25 @@ impl super::RuntimeLite for SmolRuntime {
#[cfg(feature = "time")]
type LocalSleep = AsyncIoSleep;
#[cfg(feature = "time")]
type Delay<F> = AsyncIoDelay<F> where F: Future + Send;
type Delay<F>
= AsyncIoDelay<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalDelay<F> = AsyncIoDelay<F> where F: Future;
type LocalDelay<F>
= AsyncIoDelay<F>
where
F: Future;
#[cfg(feature = "time")]
type Timeout<F> = AsyncIoTimeout<F> where F: Future + Send;
type Timeout<F>
= AsyncIoTimeout<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalTimeout<F> = AsyncIoTimeout<F> where F: Future;
type LocalTimeout<F>
= AsyncIoTimeout<F>
where
F: Future;

fn new() -> Self {
Self
Expand Down
14 changes: 8 additions & 6 deletions lite/src/smol/after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ where
impl AsyncAfterSpawner for SmolSpawner {
type JoinError = JoinError;

type JoinHandle<F> = SmolAfterHandle<F>
where
F: Send + 'static;
type JoinHandle<F>
= SmolAfterHandle<F>
where
F: Send + 'static;

fn spawn_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -335,9 +336,10 @@ impl AsyncAfterSpawner for SmolSpawner {

impl AsyncLocalAfterSpawner for SmolSpawner {
type JoinError = JoinError;
type JoinHandle<F> = SmolAfterHandle<F>
where
F: 'static;
type JoinHandle<F>
= SmolAfterHandle<F>
where
F: 'static;

fn spawn_local_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand Down
1 change: 1 addition & 0 deletions lite/src/time/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fn _assert1(_: Box<dyn AsyncLocalDelay<impl Future>>) {}
fn _assert2(_: Box<dyn AsyncDelay<impl Future>>) {}

/// Simlilar to Go's `time.AfterFunc`, but does not spawn a new thread.
///
/// If you want the future to run in its own thread, you should use
/// [`RuntimeLite::spawn_after`](crate::RuntimeLite::spawn_after) instead.
pub trait AsyncDelay<F>: Future<Output = Result<F::Output, Aborted>> + Send
Expand Down
35 changes: 26 additions & 9 deletions lite/src/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ impl Yielder for TokioSpawner {
}

impl AsyncSpawner for TokioSpawner {
type JoinHandle<F> = tokio::task::JoinHandle<F> where
F: Send + 'static;
type JoinHandle<F>
= tokio::task::JoinHandle<F>
where
F: Send + 'static;

fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -58,8 +60,10 @@ impl AsyncSpawner for TokioSpawner {
}

impl AsyncLocalSpawner for TokioSpawner {
type JoinHandle<F> = ::tokio::task::JoinHandle<F> where
F: 'static;
type JoinHandle<F>
= ::tokio::task::JoinHandle<F>
where
F: 'static;

fn spawn_local<F>(future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -73,7 +77,8 @@ impl AsyncLocalSpawner for TokioSpawner {
impl<T> super::Detach for ::tokio::task::JoinHandle<T> {}

impl AsyncBlockingSpawner for TokioSpawner {
type JoinHandle<R> = ::tokio::task::JoinHandle<R>
type JoinHandle<R>
= ::tokio::task::JoinHandle<R>
where
R: Send + 'static;

Expand Down Expand Up @@ -123,13 +128,25 @@ impl super::RuntimeLite for TokioRuntime {
#[cfg(feature = "time")]
type LocalSleep = TokioSleep;
#[cfg(feature = "time")]
type Delay<F> = TokioDelay<F> where F: Future + Send;
type Delay<F>
= TokioDelay<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalDelay<F> = TokioDelay<F> where F: Future;
type LocalDelay<F>
= TokioDelay<F>
where
F: Future;
#[cfg(feature = "time")]
type Timeout<F> = TokioTimeout<F> where F: Future + Send;
type Timeout<F>
= TokioTimeout<F>
where
F: Future + Send;
#[cfg(feature = "time")]
type LocalTimeout<F> = TokioTimeout<F> where F: Future;
type LocalTimeout<F>
= TokioTimeout<F>
where
F: Future;

fn new() -> Self {
Self
Expand Down
14 changes: 8 additions & 6 deletions lite/src/tokio/after.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,10 @@ where
impl AsyncAfterSpawner for TokioSpawner {
type JoinError = JoinError;

type JoinHandle<F> = TokioAfterHandle<F>
where
F: Send + 'static;
type JoinHandle<F>
= TokioAfterHandle<F>
where
F: Send + 'static;

fn spawn_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand All @@ -299,9 +300,10 @@ impl AsyncAfterSpawner for TokioSpawner {
impl AsyncLocalAfterSpawner for TokioSpawner {
type JoinError = JoinError;

type JoinHandle<F> = TokioAfterHandle<F>
where
F: 'static;
type JoinHandle<F>
= TokioAfterHandle<F>
where
F: 'static;

fn spawn_local_after<F>(duration: core::time::Duration, future: F) -> Self::JoinHandle<F::Output>
where
Expand Down
Loading

0 comments on commit 1a5058c

Please sign in to comment.