From 4f0b0ae8d1e3ff3c3af616e88ee7c51e583743b1 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 23 Feb 2022 02:53:56 -0500 Subject: move to tokio --- CHANGELOG.md | 6 ++++++ Cargo.toml | 6 +++--- src/lib.rs | 6 +++--- src/reader.rs | 6 +++--- src/writer.rs | 6 +++--- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0a9293..035e9f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Changed + +* moved to tokio + ## [0.3.3] - 2021-12-15 ### Fixed diff --git a/Cargo.toml b/Cargo.toml index db0dfd2..b978000 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ categories = ["parser-implementations"] include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md"] [dependencies] -futures-lite = { version = "1.12.0", optional = true } +tokio = { version = "1.17.0", optional = true, features = ["io-util"] } [features] -default = ["async"] -async = ["futures-lite"] +default = [] +async = ["tokio"] diff --git a/src/lib.rs b/src/lib.rs index d4ead83..8ef8552 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,9 +7,9 @@ //! `blocking::Writer` provide a similar API for non-asynchronous //! applications. //! -//! If you do not need the async API, the `futures` dependency can be removed -//! by building with `default_features = false` (by default, the `"async"` -//! feature is enabled). +//! # Features +//! +//! Async support via Tokio can be enabled via the `"async"` feature. #![warn(clippy::cargo)] #![warn(clippy::pedantic)] diff --git a/src/reader.rs b/src/reader.rs index 3426dcb..0b0666b 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1,13 +1,13 @@ -use futures_lite::io::AsyncReadExt as _; +use tokio::io::AsyncReadExt as _; /// Reads ttyrec frames from a [`futures_lite::io::AsyncRead`] instance. -pub struct Reader { +pub struct Reader { input: T, parser: crate::Parser, buf: [u8; 4096], } -impl Reader { +impl Reader { /// Creates a new [`Reader`](Self) from a [`futures_lite::io::AsyncRead`] /// instance. pub fn new(input: T) -> Self { diff --git a/src/writer.rs b/src/writer.rs index 9eb3aaa..6e52db1 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -1,12 +1,12 @@ -use futures_lite::io::AsyncWriteExt as _; +use tokio::io::AsyncWriteExt as _; /// Writes ttyrec frames to a [`futures_lite::io::AsyncWrite`] instance. -pub struct Writer { +pub struct Writer { output: T, creator: crate::Creator, } -impl Writer { +impl Writer { /// Creates a new [`Writer`](Self) from a [`futures_lite::io::AsyncWrite`] /// instance. pub fn new(output: T) -> Self { -- cgit v1.2.3-54-g00ecf