Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust crate tokio to 0.3.0 #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jun 13, 2023

This PR contains the following updates:

Package Type Update Change
tokio (source) dependencies minor 0.1.7 -> 0.3.0
tokio (source) dev-dependencies minor 0.1.7 -> 0.3.0

Release Notes

tokio-rs/tokio (tokio)

v0.3.7

Compare Source

v0.3.6: Tokio v0.3.6

Compare Source

Released December 14, 2020

Fixed
  • rt: fix deadlock in shutdown (#​3228)
  • rt: fix panic in task abort when off rt (#​3159)
  • sync: make add_permits panic with usize::MAX >> 3 permits (#​3188)
  • time: Fix race condition in timer drop (#​3229)
  • watch: fix spurious wakeup (#​3244)
Added
  • example: add back udp-codec example (#​3205)
  • net: add TcpStream::into_std (#​3189)

v0.3.5: Tokio v0.3.5

Compare Source

Fixed
  • rt: fix shutdown_timeout(0) (#​3196).
  • time: fixed race condition with small sleeps (#​3069).
Added
  • io: AsyncFd::with_interest() (#​3167).
  • signal: CtrlC stream on windows (#​3186).

v0.3.4: Tokio v0.3.4

Compare Source

Fixed
  • stream: StreamMap Default impl bound (#​3093).
  • io: AsyncFd::into_inner() should deregister the FD (#​3104).
Changed
  • meta: parking_lot feature enabled with full (#​3119).
Added
  • io: AsyncWrite vectored writes (#​3149).
  • net: TCP/UDP readiness and non-blocking ops (#​3130, #​2743, #​3138).
  • net: TCP socket option (linger, send/recv buf size) (#​3145, #​3143).
  • net: PID field in UCred with solaris/illumos (#​3085).
  • rt: runtime::Handle allows spawning onto a runtime (#​3079).
  • sync: Notify::notify_waiters() (#​3098).
  • sync: acquire_many(), try_acquire_many() to Semaphore (#​3067).

v0.3.3: Tokio v0.3.3

Compare Source

Fixes a soundness hole by adding a missing Send bound to Runtime::spawn_blocking().

Fixed
  • rt: include missing Send, fixing soundness hole (#​3089).
  • tracing: avoid huge trace span names (#​3074).
Added
  • net: TcpSocket::reuseport(), TcpSocket::set_reuseport() (#​3083).
  • net: TcpSocket::reuseaddr() (#​3093).
  • net: TcpSocket::local_addr() (#​3093).
  • net: add pid to UCred (#​2633).

v0.3.2: Tokio v0.3.2

Compare Source

Adds AsyncFd as a replacement for v0.2's PollEvented.

Fixed
  • io: fix a potential deadlock when shutting down the I/O driver (#​2903).
  • sync: RwLockWriteGuard::downgrade() bug (#​2957).
Added
  • io: AsyncFd for receiving readiness events on raw FDs (#​2903).
  • net: poll_* function on UdpSocket (#​2981).
  • net: UdpSocket::take_error() (#​3051).
  • sync: oneshot::Sender::poll_closed() (#​3032).

v0.3.1: Tokio v0.3.1

Compare Source

This release fixes a use-after-free in the IO driver. Additionally, the read_buf
and write_buf methods have been added back to the IO traits, as the bytes crate
is now on track to reach version 1.0 together with Tokio.

Fixed
  • net: fix use-after-free (#​3019).
  • fs: ensure buffered data is written on shutdown (#​3009).
Added
  • io: copy_buf() (#​2884).
  • io: AsyncReadExt::read_buf(), AsyncReadExt::write_buf() for working with
    Buf/BufMut (#​3003).
  • rt: Runtime::spawn_blocking() (#​2980).
  • sync: watch::Sender::is_closed() (#​2991).

v0.3.0: Tokio v0.3.0

Compare Source

This represents a 1.0 beta release. APIs are polished and future-proofed. APIs not included for 1.0 stabilization have been removed.

Biggest changes are:

  • I/O driver internal rewrite. The windows implementation includes significant
    changes.
  • Runtime API is polished, especially with how it interacts with feature flag
    combinations.
  • Feature flags are simplified
    • rt-core and rt-util are combined to rt
    • rt-threaded is renamed to rt-multi-thread to match builder API
    • tcp, udp, uds, dns are combied to net.
    • parking_lot is included with full
Changes
  • meta: Minimum supported Rust version is now 1.45.
  • io: AsyncRead trait now takes ReadBuf in order to safely handle reading
    into uninitialized memory (#​2758).
  • io: Internal I/O driver storage is now able to compact (#​2757).
  • rt: Runtime::block_on now takes &self (#​2782).
  • sync: watch reworked to decouple receiving a change notification from
    receiving the value (#​2814, #​2806).
  • sync: Notify::notify is renamed to notify_one (#​2822).
  • process: Child::kill is now an async fn that cleans zombies (#​2823).
  • sync: use const fn constructors as possible (#​2833, #​2790)
  • signal: reduce cross-thread notification (#​2835).
  • net: tcp,udp,uds types support operations with &self (#​2828, #​2919, #​2934).
  • sync: blocking mpsc channel supports send with &self (#​2861).
  • time: rename delay_for and delay_until to sleep and sleep_until (#​2826).
  • io: upgrade to mio 0.7 (#​2893).
  • io: AsyncSeek trait is tweaked (#​2885).
  • fs: File operations take &self (#​2930).
  • rt: runtime API, and #[tokio::main] macro polish (#​2876)
  • rt: Runtime::enter uses an RAII guard instead of a closure (#​2954).
  • net: the from_std function on all sockets no longer sets socket into non-blocking mode (#​2893)
Added
  • sync: map function to lock guards (#​2445).
  • sync: blocking_recv and blocking_send fns to mpsc for use outside of Tokio (#​2685).
  • rt: Builder::thread_name_fn for configuring thread names (#​1921).
  • fs: impl FromRawFd and FromRawHandle for File (#​2792).
  • process: Child::wait and Child::try_wait (#​2796).
  • rt: support configuring thread keep-alive duration (#​2809).
  • rt: task::JoinHandle::abort forcibly cancels a spawned task (#​2474).
  • sync: RwLock write guard to read guard downgrading (#​2733).
  • net: add poll_* functions that take &self to all net types (#​2845)
  • sync: get_mut() for Mutex, RwLock (#​2856).
  • sync: mpsc::Sender::closed() waits for Receiver half to close (#​2840).
  • sync: mpsc::Sender::is_closed() returns true if Receiver half is closed (#​2726).
  • stream: iter and iter_mut to StreamMap (#​2890).
  • net: implement AsRawSocket on windows (#​2911).
  • net: TcpSocket creates a socket without binding or listening (#​2920).
Removed
  • io: vectored ops are removed from AsyncRead, AsyncWrite traits (#​2882).
  • io: mio is removed from the public API. PollEvented and Registration are
    removed (#​2893).
  • io: remove bytes from public API. Buf and BufMut implementation are
    removed (#​2908).
  • time: DelayQueue is moved to tokio-util (#​2897).
Fixed
  • io: stdout and stderr buffering on windows (#​2734).

v0.2.25

Compare Source

v0.2.24

Compare Source

v0.2.23: Tokio v0.2.23

Compare Source

Maintenance release.

Fixes
  • time: report correct error for timers that exceed max duration (#​2023)
  • time: fix resetting expired timers causing panics (#​2587)
  • macros: silence unreachable_code warning in select! (#​2678)
  • rt: fix potential leak during runtime shutdown (#​2649)
  • sync: fix missing notification during mpsc close (#​2854)
Changes
  • io: always re-export std::io (#​2606)
  • dependencies: update parking_lot dependency to 0.11.0 (#​2676)
  • io: rewrite read_to_end and read_to_string (#​2560)
  • coop: reset coop budget when blocking in block_on (#​2711)
  • sync: better Debug for Mutex (#​2725)
  • net: make UnixListener::poll_accept public (#​2880)
  • dep: raise lazy_static to 1.4.0 (#​3132)
  • dep: raise slab to 0.4.2 (#​3132)
Added
  • io: add io::duplex() as bidirectional reader/writer (#​2661)
  • net: introduce split and into_split on UnixDatagram (#​2557)
  • net: ensure that unix sockets have both split and into_split (#​2687)
  • net: add try_recv/from & try_send/to to UnixDatagram (#​1677)
  • net: Add UdpSocket::{try_send,try_send_to} methods (#​1979)
  • net: implement ToSocketAddrs for (String, u16) (#​2724)
  • io: add ReaderStream (#​2714)
  • sync: implement map methods (#​2771)

v0.2.22: Tokio v0.2.22

Compare Source

This release introduces initial support for [tracing][tracing] instrumentation within the Tokio
runtime, enabled by the "tracing" feature flag. In addition, it contains a number of bug
fixes and API additions.

Fixes
Changes
  • coop: returning Poll::Pending no longer decrements the task budget (#​2549)
Added
  • io: little-endian variants of AsyncReadExt and AsyncWriteExt methods
    (#​1915)
  • task: add [tracing][tracing] instrumentation to spawned tasks (#​2655)
  • sync: allow unsized types in Mutex and RwLock (via default constructors)
    (#​2615)
  • net: add ToSocketAddrs implementation for &[SocketAddr] (#​2604)
  • fs: add OpenOptionsExt for OpenOptions (#​2515)
  • fs: add DirBuilder (#​2524)

Signed-off-by: Eliza Weisman [email protected]

v0.2.21: Tokio v0.2.21

Compare Source

Bug fixes and API polish.

Fixes
  • macros: disambiguate built-in #[test] attribute in macro expansion (#​2503)
  • rt: LocalSet and task budgeting (#​2462).
  • rt: task budgeting with block_in_place (#​2502).
  • sync: release broadcast channel memory without sending a value (#​2509).
  • time: notify when resetting a Delay to a time in the past (#​2290).
Added
  • io: get_mut, get_ref, and into_inner to Lines (#​2450).
  • io: mio::Ready argument to PollEvented (#​2419).
  • os: illumos support (#​2486).
  • rt: Handle::spawn_blocking (#​2501).
  • sync: OwnedMutexGuard for Arc<Mutex<T>> (#​2455).

v0.2.20: Tokio v0.2.20

Compare Source

Fixes
  • sync: broadcast closing the channel no longer requires capacity (#​2448).
  • rt: regression when configuring runtime with max_threads less than the number of CPUs (#​2457).

v0.2.19: Tokio v0.2.19

Compare Source

Fixes
Added

v0.2.18: Tokio v0.2.18

Compare Source

Fixes a regression with LocalSet that allowed !Send futures to cross threads.

This change makes LocalSet !Send. The Send implementation was accidentally added in v0.2.14. Removing the Send implementation is not considered a breaking change as it fixes a soundness bug and the implementation was accidental.

Fixes
  • task: LocalSet was incorrectly marked as Send (#​2398)
  • io: correctly report WriteZero failure in write_int (#​2334)

v0.2.17: Tokio 0.2.17

Compare Source

This release fixes a bug in the threaded scheduler that could result in panics under load (see #​2382). Additionally, the default number of worker threads now uses the logical CPU count, so it will now respect scheduler affinity and cgroups CPU quotas.

Fixes
  • rt: bug in work-stealing queue (#​2387)
Changes
  • rt: threadpool uses logical CPU count instead of physical by default (#​2391)

v0.2.16: Tokio 0.2.16

Compare Source

This release fixes a regression in tokio::sync and a bug in tokio::fs::copy. It also
adds a new APIs to tokio::time and tokio::io.

Fixes
  • sync: fix a regression where Mutex, Semaphore, and RwLock futures no
    longer implement Sync (#​2375)
  • fs: fix fs::copy not copying file permissions (#​2354)
Added
  • time: added deadline method to delay_queue::Expired (#​2300)
  • io: added StreamReader (#​2052)

v0.2.15: Tokio v0.2.15

Compare Source

Fixes a queue regression and adds a new disarm fn to mpsc::Sender.

Fixes
Added
  • sync: Add disarm to mpsc::Sender (#​2358).

v0.2.14: Tokio v0.2.14

Compare Source

This release introduces automatic cooperative task yielding. This article describes the new functionality in more detail.

Fixes
  • rt: concurrency bug in scheduler (#​2273).
  • rt: concurrency bug with shell runtime (#​2333).
  • test-util: correct pause/resume of time (#​2253).
  • time: DelayQueue correct wakeup after insert (#​2285).
Added
Changed
  • sync: semaphore, mutex internals rewritten to avoid allocations (#​2325).

v0.2.13: Tokio v0.2.13

Compare Source

Fixes a minor bug in the previous release that resulted in compilation errors using the new pin! form.

Fixes
  • macros: unresolved import in pin! (#​2281).

v0.2.12: Tokio v0.2.12

Compare Source

Polish, small additions, and fixes. The biggest additions in this release are StreamMap and Notify.

StreamMap

Similar to StreamExt::merge, StreamMap supports merging multiple source streams into a single stream, producing items as they become available in the source streams. However, StreamMap supports inserting and removing streams at run-time. This is useful for cases where a consumer wishes to subscribe to messages from multiple sources and dynamically manage those subscriptions.

As the name implies, StreamMap maps keys to streams. Streams are [inserted] or [removed] as needed and then the StreamMap is used as any other stream. Items are returned with their keys, enabling the caller to identify which source stream the item originated from.

Example
use tokio::stream::{StreamExt, StreamMap};
use tokio::sync::mpsc;

#[tokio::main]
async fn main() {
    let (mut tx1, rx1) = mpsc::channel(10);
    let (mut tx2, rx2) = mpsc::channel(10);
    // use `Sender` handles

    let mut map = StreamMap::new();

    // Insert both streams
    map.insert("one", rx1);
    map.insert("two", rx2);

    // Read twice
    for _ in 0..2 {
        let (key, val) = map.next().await.unwrap();

        println!("got {} from {}", val, key);

        // Remove the stream to prevent reading the next value
        map.remove(key);
    }
}

Notify

Notify is the next step in providing async / await based synchronization primitives. It is similar to how thread::park() / unpark() work, but for asynchronous tasks. Consumers await notifications and producers notify consumers. Notify is intended to be used as a building block for higher level synchronization primitives, such as channels.

Examples

Basic usage.

use tokio::sync::Notify;
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let notify = Arc::new(Notify::new());
    let notify2 = notify.clone();

    tokio::spawn(async move {
        notify2.notified().await;
        println!("received notification");
    });

    println!("sending notification");
    notify.notify();
}

Here is how Notify can be used as a building block for an unbounded channel.

use tokio::sync::Notify;

use std::collections::VecDeque;
use std::sync::Mutex;

struct Channel<T> {
    values: Mutex<VecDeque<T>>,
    notify: Notify,
}

impl<T> Channel<T> {
    pub fn send(&self, value: T) {
        self.values.lock().unwrap()
            .push_back(value);

        // Notify the consumer a value is available
        self.notify.notify();
    }

    pub async fn recv(&self) -> T {
        loop {
            // Drain values
            if let Some(value) = self.values.lock().unwrap().pop_front() {
                return value;
            }

            // Wait for values to be available
            self.notify.notified().await;
        }
    }
}

Changes

Fixes
  • net: UnixStream::poll_shutdown should call shutdown(Write) (#​2245).
  • process: Wake up read and write on EPOLLERR (#​2218).
  • rt: potential deadlock when using block_in_place and shutting down the
    runtime (#​2119).
  • rt: only detect number of CPUs if core_threads not specified (#​2238).
  • sync: reduce watch::Receiver struct size (#​2191).
  • time: succeed when setting delay of $MAX-1 (#​2184).
  • time: avoid having to poll DelayQueue after inserting new delay (#​2217).
Added
  • macros: pin! variant that assigns to identifier and pins (#​2274).
  • net: impl Stream for Listener types (#​2275).
  • rt: Runtime::shutdown_timeout waits for runtime to shutdown for specified
    duration (#​2186).
  • stream: StreamMap merges streams and can insert / remove streams at
    runtime (#​2185).
  • stream: StreamExt::skip() skips a fixed number of items (#​2204).
  • stream: StreamExt::skip_while() skips items based on a predicate (#​2205).
  • sync: Notify provides basic async / await task notification (#​2210).
  • sync: Mutex::into_inner retrieves guarded data (#​2250).
  • sync: mpsc::Sender::send_timeout sends, waiting for up to specified duration
    for channel capacity (#​2227).
  • time: impl Ord and Hash for Instant (#​2239).

v0.2.11: Tokio v0.2.11

Compare Source

Introduces [select!][select!], [join!][join!], and [try_join!][try_join!] macros for waiting on multiple async operations concurrently from the same task. These macros are implemented primarily as declarative macros, which works around the recursion limit issue. The select! macro works with any type that implements Future and does not require special FusedFuture traits.

Fixes
Added
  • optional support for using parking_lot internally (#​2164).
  • fs: fs::copy, an async version of std::fs::copy (#​2079).
  • macros: select! waits for the first branch to complete (#​2152).
  • macros: join! waits for all branches to complete (#​2158).
  • macros: try_join! waits for all branches to complete or the first error (#​2169).
  • macros: pin! pins a value to the stack (#​2163).
  • net: ReadHalf::poll() and ReadHalf::poll_peak (#​2151)
  • stream: StreamExt::timeout() sets a per-item max duration (#​2149).
  • stream: StreamExt::fold() applies a function, producing a single value. (#​2122).
  • sync: impl Eq, PartialEq for oneshot::RecvError (#​2168).
  • task: methods for inspecting the JoinError cause (#​2051).

v0.2.10: Tokio v0.2.10

Compare Source

Introduces a task-local storage solution that works with Rust's "task" concept and supports multiplexing futures on the same runtime task (#​2126). A number of other incremental improvements are included.

This release includes a few fixes, including fixing a scenario in which undefined behavior could be introduced when the user provided a buggy AsyncRead implementation.

Fixes
  • #[tokio::main] when rt-core feature flag is not enabled (#​2139).
  • remove AsyncBufRead from BufStream impl block (#​2108).
  • potential undefined behavior when implementing AsyncRead incorrectly (#​2030).
Added
  • BufStream::with_capacity (#​2125).
  • impl From and Default for RwLock (#​2089).
  • io::ReadHalf::is_pair_of checks if provided WriteHalf is for the same
    underlying object (#​1762, #​2144).
  • runtime::Handle::try_current() returns a handle to the current runtime (#​2118).
  • stream::empty() returns an immediately ready empty stream (#​2092).
  • stream::once(val) returns a stream that yields a single value: val (#​2094).
  • stream::pending() returns a stream that never becomes ready (#​2092).
  • StreamExt::chain() sequences a second stream after the first completes (#​2093).
  • StreamExt::collect() transform a stream into a collection (#​2109).
  • StreamExt::fuse ends the stream after the first None (#​2085).
  • StreamExt::merge combines two streams, yielding values as they become ready (#​2091).
  • Task-local storage (#​2126).

v0.2.9: Tokio v0.2.9

Compare Source

Includes only fixes.

Fixes
  • AsyncSeek impl for File (#​1986).
  • rt: shutdown deadlock in threaded_scheduler (#​2074, #​2082).
  • rt: memory ordering when dropping JoinHandle (#​2044).
  • docs: misc API documentation fixes and improvements.

v0.2.8: Tokio v0.2.8

Compare Source

A breaking change was accidentally introduced in tokio-macros. The breaking change was reverted and Tokio v0.2.8 depends on the correct version of tokio-macros.

Fixes
  • depend on new version of tokio-macros.

v0.2.7: Tokio v0.2.7

Compare Source

This release includes both bug fixes and incremental improvements across most of Tokio. The primary bug fixes are to Runtime configured with basic_scheduler and task::LocalSet.

Fixes
  • potential deadlock when dropping basic_scheduler Runtime.
  • calling spawn_blocking from within a spawn_blocking (#​2006).
  • storing a Runtime instance in a thread-local (#​2011).
  • miscellaneous documentation fixes.
  • rt: fix Waker::will_wake to return true when tasks match (#​2045).
  • test-util: time::advance runs pending tasks before changing the time (#​2059).
Added
  • net::lookup_host maps a T: ToSocketAddrs to a stream of SocketAddrs (#​1870).
  • process::Child fields are made public to match std (#​2014).
  • impl Stream for sync::broadcast::Receiver (#​2012).
  • sync::RwLock provides an asynchonous read-write lock (#​1699).
  • runtime::Handle::current returns the handle for the current runtime (#​2040).
  • StreamExt::filter filters stream values according to a predicate (#​2001).
  • StreamExt::filter_map simultaneously filter and map stream values (#​2001).
  • StreamExt::try_next convenience for streams of Result<T, E> (#​2005).
  • StreamExt::take limits a stream to a specified number of values (#​2025).
  • StreamExt::take_while limits a stream based on a predicate (#​2029).
  • StreamExt::all tests if every element of the stream matches a predicate (#​2035).
  • StreamExt::any tests if any element of the stream matches a predicate (#​2034).
  • task::LocalSet.await runs spawned tasks until the set is idle (#​1971).
  • time::DelayQueue::len returns the number entries in the queue (#​1755).
  • expose runtime options from the #[tokio::main] and #[tokio::test] (#​2022).

v0.2.6: Tokio v0.2.6

Compare Source

This release fixes an API regression introduced as part of v0.2.5.

Fixes
  • fs::File::seek API regression (#​1991).

v0.2.5: Tokio v0.2.5

Compare Source

Includes new APIs, utilities, and fixes. Some highlights:

tokio::sync::broadcast

A multi-producer, multi-consumer channel where each sent value is sent to all consumers (fan-out). The channel is bounded and when consumers lag, they will receive an error indicating they have lagged too far behind.

use tokio::sync::broadcast;

#[tokio::main]
async fn main() {
    let (tx, mut rx1) = broadcast::channel(16);
    let mut rx2 = tx.subscribe();

    tokio::spawn(async move {
        assert_eq!(rx1.recv().await.unwrap(), 10);
        assert_eq!(rx1.recv().await.unwrap(), 20);
    });

    tokio::spawn(async move {
        assert_eq!(rx2.recv().await.unwrap(), 10);
        assert_eq!(rx2.recv().await.unwrap(), 20);
    });

    tx.send(10).unwrap();
    tx.send(20).unwrap();
}

Senders never block. When the channel is full, the oldest value still held by the channel is overwritten. This tends to be the desired behavior in order to prevent slow consumers from blocking the entire system. However, you can use a Semaphore (also added in this release) to ensure that all consumers see all messages.

tokio::sync::Semaphore

A counting synchronization primitive. It is used to limit a critical section to 1 or more concurrent tasks. For example, assume we wish to limit the number of in-flight database queries, we could do something like:

struct MyDbClient {
    db: MyDbHandle,
    semaphore: tokio::sync:Semaphore,
}

async fn query(client: &MyDbClient, query: Query) -> QueryResult {
     let _permit = client.semaphore.acquire().await;
     client.db.query(query).await
}

There may be any number of concurrent calls to query, but the semaphore will limit the number that are able to concurrently perform the query.

Added
  • io::AsyncSeek trait (#​1924).
  • Mutex::try_lock (#​1939)
  • mpsc::Receiver::try_recv and mpsc::UnboundedReceiver::try_recv (#​1939).
  • writev support for TcpStream (#​1956).
  • time::throttle for throttling streams (#​1949).
  • implement Stream for time::DelayQueue (#​1975).
  • sync::broadcast provides a fan-out channel (#​1943).
  • sync::Semaphore provides an async semaphore (#​1973).
  • stream::StreamExt provides stream utilities (#​1962).
Fixes
Changes
  • runtime threads are configured with runtime::Builder::core_threads and
    runtime::Builder::max_threads. runtime::Builder::num_threads is
    deprecated (#​1977).

v0.2.4: Tokio v0.2.4

Compare Source

A small release to fix a potential deadlock when using Mutex.

Fixes
  • sync::Mutex deadlock when lock() future is dropped early (#​1898).

v0.2.3: Tokio v0.2.3

Compare Source

Mostly a bug fix, doc improvement, and polish release. The biggest new addition are the new helpers to read and write integers. They are on [AsyncReadExt][AsyncReadExt] and [AsyncWriteExt][AsyncWriteExt] and can make protocol encoding / decoding easier. For example, working with length delimited payloads might look like:

use tokio::io::{self, AsyncReadExt, AsyncWriteExt, BufStream};
use tokio::net::TcpStream;

async fn read_frame(src: &mut BufStream<TcpStream>) -> io::Result<Vec<u8>> {
     let len = src.read_u32().await?;
     let mut frame = vec![0; len as usize];
     src.read_exact(&mut frame).await?;

    Ok(frame)
}

async fn write_frame(dst: &mut BufStream<TcpStream>, frame: &[u8]) -> io::Result<()> {
    dst.write_u32(frame.len() as u32).await?;
    dst.write_all(frame).await?;
    dst.flush().await?;

    Ok(())
}
Added
  • read / write integers using AsyncReadExt and AsyncWriteExt (#​1863).
  • read_buf / write_buf for reading / writing Buf / BufMut (#​1881).
  • TcpStream::poll_peek - pollable API for performing TCP peek (#​1864).
  • sync::oneshot::error::TryRecvError provides variants to detect the error
    kind (#​1874).
  • LocalSet::block_on accepts !'static task (#​1882).
  • task::JoinError is now Sync (#​1888).
  • impl conversions between tokio::time::Instant and
    std::time::Instant (#​1904).
Fixes

v0.2.2: Tokio v0.2.2

Compare Source

Primarily a release fix for basic_scheduler and task::LocalSet.

task::LocalSet was introduced in v0.2.1 and provides tooling to run !Send tasks. The task::LocalSet structure replaces the need to have separate runtimes. The advantage being that it can be used with the threaded runtime in order to run both Send futures across multiple threads and !Send futures on the current thread.

use tokio::runtime::Runtime;
use tokio::task;

use std::rc::Rc;

let unsend_data = Rc::new("my unsend data...");

let mut rt = Runtime::new().unwrap();

// Construct a local task set that can run `!Send` futures.
let local = task::LocalSet::new();

// Run the local task group.
local.block_on(&mut rt, async move {
    let unsend_data = unsend_data.clone();
    // `spawn_local` ensures that the future is spawned on the local
    // task group.
    task::spawn_local(async move {
        println!("{}", unsend_data);
        // ...
    }).await.unwrap();
});
Fixes
  • scheduling with basic_scheduler (#​1861).
  • update spawn panic message to specify that a task scheduler is required (#​1839).
  • API docs example for runtime::Builder to include a task scheduler (#​1841).
  • general documentation (#​1834).
  • building on illumos/solaris (#​1772).
  • panic when dropping LocalSet (#​1843).
  • API docs mention the required Cargo features for Builder::basic_scheduler and Builder::threaded_scheduler (#​1858).
Added
  • impl Stream for signal::unix::Signal (#​1849).
  • API docs for platform specific behavior of signal::ctrl_c and signal::unix::Signal (#​1854).
  • API docs for signal::unix::Signal::{recv, poll_recv} and signal::windows::CtrlBreak::{recv, poll_recv} (#​1854).
  • File::into_std and File::try_into_std methods (#​1856).

v0.2.1: Tokio v0.2.1

Compare Source

Fixes
  • API docs for TcpListener::incoming, UnixListener::incoming (#​1831).
Added
  • tokio::task::LocalSet provides a strategy for spawning !Send tasks (#​1733).
  • export tokio::time::Elapsed (#​1826).
  • impl AsRawFd, AsRawHandle for tokio::fs::File (#​1827).

v0.2.0: Tokio v0.2.0

Compare Source

A major breaking change. Most implementation and APIs have changed one way or
another. This changelog entry contains a highlight

Changed
  • APIs are updated to use async / await.
  • most tokio-* crates are collapsed into this crate.
  • Scheduler is rewritten.
  • tokio::spawn returns a JoinHandle.
  • A single I/O / timer is used per runtime.
  • I/O driver uses a concurrent slab for allocating state.
  • components are made available via feature flag.
  • Use bytes 0.5
  • tokio::codec is moved to tokio-util.
Removed
  • Standalone timer and net drivers are removed, use Runtime instead
  • current_thread runtime is removed, use tokio::runtime::Runtime with
    basic_scheduler instead.

v0.1.22

Compare Source

v0.1.21

Compare Source

v0.1.20

Compare Source

v0.1.19

Compare Source

v0.1.18

Compare Source

v0.1.17

Compare Source

v0.1.16

Compare Source

v0.1.15

Compare Source

[v0.1.14](https://redirect.github.com/tokio-rs/t


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/tokio-0.x branch from 8bae963 to 41ce6ff Compare May 5, 2024 10:06
@renovate renovate bot changed the title Update Rust crate tokio to 0.3.7 Update Rust crate tokio to 0.3.0 May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant