tokio-macros
Tokio's proc macros.
2.7.2
733M downloads/mo
#107 most downloaded on crates.io
tokio-rs/tokio
What this package is like to depend on
Last release 25 days ago
29 Jul 2026
Ships fairly regularly
a new release about every 4 months
Nearly every release is documented
notes for 31 of 32 stable releases
3 versions withdrawn
withdrawn after publishing
7 years old
41 releases · first in 2019
5 releases in the last 12 months
see the full history below
Release timeline
41 releases · Apr 2019 to Jul 2026Releases
latest 41-
2.7.229 Jul 2026 -
2.7.117 Jul 2026 -
2.7.003 Apr 2026 -
2.6.102 Mar 2026 -
2.6.014 Oct 2025 -
2.5.008 Jan 2025 -
2.4.023 Jul 2024 -
2.3.030 May 2024Release notes
Open source →- macros: make
#[tokio::test]append#[test]at the end of the attribute list (#6497)
- macros: make
-
2.2.009 Nov 2023Release notes
Open source →Changed
- use
::corequalified imports instead of::stdinsidetokio::testmacro (#5973)
- use
-
2.1.025 Apr 2023Release notes
Open source → -
2.0.027 Mar 2023Release notes
Open source →This major release updates the dependency on the syn crate to 2.0.0, and increases the MSRV to 1.56.
As part of this release, we are adopting a policy of depending on a specific minor release of tokio-macros. This prevents Tokio from being able to pull in many different versions of tokio-macros.
-
1.8.230 Nov 2022Release notes
Open source → -
1.8.129 Nov 2022 withdrawnRelease notes
Open source → -
1.8.004 Jun 2022Release notes
Open source →Added
- io: add
get_{ref,mut}methods toAsyncFdReadyGuardandAsyncFdReadyMutGuard(#3807) - io: efficient implementation of vectored writes for
BufWriter(#3163) - net: add ready/try methods to
NamedPipe{Client,Server}(#3866, #3899) - sync: add
watch::Receiver::borrow_and_update(#3813) - sync: implement
From<T>forOnceCell<T>(#3877) - time: allow users to specify Interval behavior when delayed (#3721)
Added (unstable)
- rt: add
tokio::task::Builder(#3881)
Fixed
- net: handle HUP event with
UnixStream(#3898)
Documented
- io: add
-
1.7.015 Dec 2021Release notes
Open source →- macros: address remaining
clippy::semicolon_if_nothing_returnedwarning (#4252)
Release notes
Open source →Added
- net: add named pipes on windows (#3760)
- net: add
TcpSocketfromstd::net::TcpStreamconversion (#3838) - sync: add
receiver_counttowatch::Sender(#3729) - sync: export
sync::notify::Notifiedfuture publicly (#3840) - tracing: instrument task wakers (#3836)
Fixed
- macros: suppress
clippy::default_numeric_fallbacklint in generated code (#3831) - runtime: immediately drop new tasks when runtime is shut down (#3752)
- sync: deprecate unused
mpsc::RecvErrortype (#3833)
Documented
- macros: address remaining
-
1.6.016 Nov 2021Release notes
Open source →Added
- fs: try doing a non-blocking read before punting to the threadpool (#3518)
- io: add
write_all_buftoAsyncWriteExt(#3737) - io: implement
AsyncSeekforBufReader,BufWriter, andBufStream(#3491) - net: support non-blocking vectored I/O (#3761)
- sync: add
mpsc::Sender::{reserve_owned, try_reserve_owned}(#3704) - sync: add a
MutexGuard::mapmethod that returns aMappedMutexGuard(#2472) - time: add getter for Interval's period (#3705)
Fixed
- io: wake pending writers on
DuplexStreamclose (#3756) - process: avoid redundant effort to reap orphan processes (#3743)
- signal: use
std::os::raw::c_intinstead oflibc::c_inton public API (#3774) - sync: preserve permit state in
notify_waiters(#3660) - task: update
JoinHandlepanic message (#3727) - time: prevent
time::advancefrom going too far (#3712)
Documented
-
1.5.129 Oct 2021 -
1.5.013 Oct 2021Release notes
Open source →Added
- io: add
AsyncSeekExt::stream_position(#3650) - io: add
AsyncWriteExt::write_vectored(#3678) - io: add a
copy_bidirectionalutility (#3572) - net: implement
IntoRawFdforTcpSocket(#3684) - sync: add
OnceCell(#3591) - sync: add
OwnedRwLockReadGuardandOwnedRwLockWriteGuard(#3340) - sync: add
Semaphore::is_closed(#3673) - sync: add
mpsc::Sender::capacity(#3690) - sync: allow configuring
RwLockmax reads (#3644) - task: add
sync_scopeforLocalKey(#3612)
Fixed
- chore: try to avoid
noaliasattributes on intrusive linked list (#3654) - rt: fix panic in
JoinHandle::abort()when called from other threads (#3672) - sync: don't panic in
oneshot::try_recv(#3674) - sync: fix notifications getting dropped on receiver drop (#3652)
- sync: fix
Semaphorepermit overflow calculation (#3644)
Documented
- io: add
-
1.4.130 Sep 2021 -
1.4.029 Sep 2021 withdrawnRelease notes
Open source →(yanked)
Changed
- macros: run
current_threadinsideLocalSet(#4027) - macros: explicitly relaxed clippy lint for
.expect()in runtime entry macro (#4030)
Fixed
- macros: fix invalid error messages in functions wrapped with
#[main]or#[test](#4067)
Release notes
Open source →Added
Fixed
- runtime: avoid unnecessary polling of
block_onfuture (#3582) - runtime: fix memory leak/growth when creating many runtimes (#3564)
- runtime: mark
EnterGuardwithmust_use(#3609)
Documented
- macros: run
-
1.3.007 Jul 2021Release notes
Open source →Added
- coop: expose an
unconstrained()opt-out (#3547) - net: add
into_stdfor net types without it (#3509) - sync: add
same_channelmethod tompsc::Sender(#3532) - sync: add
{try_,}acquire_many_ownedtoSemaphore(#3535) - sync: add back
RwLockWriteGuard::mapandRwLockWriteGuard::try_map(#3348)
Fixed
- sync: allow
oneshot::Receiver::closeafter successfultry_recv(#3552) - time: do not panic on
timeout(Duration::MAX)(#3551)
Documented
- doc: doc aliases for pre-1.0 function names (#3523)
- io: fix typos (#3541)
- io: note the EOF behavior of
read_until(#3536) - io: update
AsyncRead::poll_readdoc (#3557) - net: update
UdpSocketsplitting doc (#3517) - runtime: add link to
LocalSetonnew_current_thread(#3508) - runtime: update documentation of thread limits (#3527)
- sync: do not recommend
join_allforBarrier(#3514) - sync: documentation for
oneshot(#3592) - sync: rename
notifytonotify_one(#3526) - time: fix typo in
Sleepdoc (#3515) - time: sync
interval.rsandtime/mod.rsdocs (#3533)
- coop: expose an
-
1.2.014 May 2021Release notes
Open source →Added
- signal: make
Signal::poll_recvmethod public (#3383)
Fixed
- time: make
test-utilpaused time fully deterministic (#3492)
Documented
- sync: link to new broadcast and watch wrappers (#3504)
- signal: make
-
1.1.005 Feb 2021Release notes
Open source →Added
- net: add
try_read_bufandtry_recv_buf(#3351) - mpsc: Add
Sender::try_reservefunction (#3418) - sync: add
RwLocktry_readandtry_writemethods (#3400) - io: add
ReadBuf::inner_mut(#3443)
Changed
- macros: improve
select!error message (#3352) - io: keep track of initialized bytes in
read_to_end(#3426) - runtime: consolidate errors for context missing (#3441)
Fixed
Documented
- stream: link to new
Streamwrappers intokio-stream(#3343) - docs: mention that
test-utilfeature is not enabled with full (#3397) - process: add documentation to process::Child fields (#3437)
- io: clarify
AsyncFddocs about changes of the inner fd (#3430) - net: update datagram docs on splitting (#3448)
- time: document that
Sleepis notUnpin(#3457) - sync: add link to
PollSemaphore(#3456) - task: add
LocalSetexample (#3438) - sync: improve bounded
mpscdocumentation (#3458)
- net: add
-
1.0.023 Dec 2020Release notes
Open source →Commit to the API and long-term support.
Fixed
- sync: spurious wakeup in
watch(#3234).
Changed
- io: rename
AsyncFd::with_io()totry_io()(#3306) - fs: avoid OS specific
*Exttraits in favor of conditionally defining the fn (#3264). - fs:
Sleepis!Unpin(#3278). - net: pass
SocketAddrby value (#3125). - net:
TcpStream::poll_peektakesReadBuf(#3259). - rt: rename
runtime::Builder::max_threads()tomax_blocking_threads()(#3287). - time: require
current_threadruntime when callingtime::pause()(#3289).
Removed
- remove
tokio::prelude(#3299). - io: remove
AsyncFd::with_poll()(#3306). - net: remove
{Tcp,Unix}Stream::shutdown()in favor ofAsyncWrite::shutdown()(#3298). - stream: move all stream utilities to
tokio-streamuntilStreamis added tostd(#3277). - sync: mpsc
try_recv()due to unexpected behavior (#3263). - tracing: make unstable as
tracing-coreis not 1.0 yet (#3266).
Added
- fs:
poll_*fns toDirEntry(#3308). - io:
poll_*fns toio::Lines,io::Split(#3308). - io:
_mutmethod variants toAsyncFd(#3304). - net:
poll_*fns toUnixDatagram(#3223). - net:
UnixStreamreadiness and non-blocking ops (#3246). - sync:
UnboundedReceiver::blocking_recv()(#3262). - sync:
watch::Sender::borrow()(#3269). - sync:
Semaphore::close()(#3065). - sync:
poll_recvfns tompsc::Receiver,mpsc::UnboundedReceiver(#3308). - time:
poll_tickfn totime::Interval(#3316).
- sync: spurious wakeup in
-
0.3.219 Dec 2020Release notes
Open source →Adds
AsyncFdas a replacement for v0.2'sPollEvented.Fixed
- io: fix a potential deadlock when shutting down the I/O driver (#2903).
- sync:
RwLockWriteGuard::downgrade()bug (#2957).
Added
-
0.3.126 Oct 2020Release notes
Open source →This release fixes an use-after-free in the IO driver. Additionally, the
read_bufandwrite_bufmethods 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
Added
-
0.3.015 Oct 2020Release notes
Open source →- Track
tokio0.3 release.
Changed
- options are renamed to track
tokioruntime builder fn names. #[tokio::main]macro requiresrt-multi-threadwhen noflavoris specified.
Release notes
Open 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-coreandrt-utilare combined tortrt-threadedis renamed tort-multi-threadto match builder APItcp,udp,uds,dnsare combined tonet.parking_lotis included withfull
Changes
- meta: Minimum supported Rust version is now 1.45.
- io:
AsyncReadtrait now takesReadBufin order to safely handle reading into uninitialized memory (#2758). - io: Internal I/O driver storage is now able to compact (#2757).
- rt:
Runtime::block_onnow takes&self(#2782). - sync:
watchreworked to decouple receiving a change notification from receiving the value (#2814, #2806). - sync:
Notify::notifyis renamed tonotify_one(#2822). - process:
Child::killis now anasync fnthat cleans zombies (#2823). - sync: use
const fnconstructors as possible (#2833, #2790) - signal: reduce cross-thread notification (#2835).
- net: tcp,udp,uds types support operations with
&self(#2828, #2919, #2934). - sync: blocking
mpscchannel supportssendwith&self(#2861). - time: rename
delay_foranddelay_untiltosleepandsleep_until(#2826). - io: upgrade to
mio0.7 (#2893). - io:
AsyncSeektrait is tweaked (#2885). - fs:
Fileoperations take&self(#2930). - rt: runtime API, and
#[tokio::main]macro polish (#2876) - rt:
Runtime::enteruses an RAII guard instead of a closure (#2954). - net: the
from_stdfunction on all sockets no longer sets socket into non-blocking mode (#2893)
Added
- sync:
mapfunction to lock guards (#2445). - sync:
blocking_recvandblocking_sendfns tompscfor use outside of Tokio (#2685). - rt:
Builder::thread_name_fnfor configuring thread names (#1921). - fs: impl
FromRawFdandFromRawHandleforFile(#2792). - process:
Child::waitandChild::try_wait(#2796). - rt: support configuring thread keep-alive duration (#2809).
- rt:
task::JoinHandle::abortforcibly cancels a spawned task (#2474). - sync:
RwLockwrite guard to read guard downgrading (#2733). - net: add
poll_*functions that take&selfto all net types (#2845) - sync:
get_mut()forMutex,RwLock(#2856). - sync:
mpsc::Sender::closed()waits forReceiverhalf to close (#2840). - sync:
mpsc::Sender::is_closed()returns true ifReceiverhalf is closed (#2726). - stream:
iteranditer_muttoStreamMap(#2890). - net: implement
AsRawSocketon windows (#2911). - net:
TcpSocketcreates a socket without binding or listening (#2920).
Removed
- io: vectored ops are removed from
AsyncRead,AsyncWritetraits (#2882). - io:
miois removed from the public API.PollEventedandRegistrationare removed (#2893). - io: remove
bytesfrom public API.BufandBufMutimplementation are removed (#2908). - time:
DelayQueueis moved totokio-util(#2897).
Fixed
- io:
stdoutandstderrbuffering on windows (#2734).
- Track
-
0.2.611 Nov 2020 -
0.2.527 Feb 2020Release notes
Open source →Added
io::AsyncSeektrait (#1924).Mutex::try_lock(#1939)mpsc::Receiver::try_recvandmpsc::UnboundedReceiver::try_recv(#1939).writevsupport forTcpStream(#1956).time::throttlefor throttling streams (#1949).- implement
Streamfortime::DelayQueue(#1975). sync::broadcastprovides a fan-out channel (#1943).sync::Semaphoreprovides an async semaphore (#1973).stream::StreamExtprovides stream utilities (#1962).
Fixes
- deadlock risk while shutting down the runtime (#1972).
- panic while shutting down the runtime (#1978).
sync::MutexGuarddebug output (#1961).- misc doc improvements (#1933, #1934, #1940, #1942).
Changes
- runtime threads are configured with
runtime::Builder::core_threadsandruntime::Builder::max_threads.runtime::Builder::num_threadsis deprecated (#1977).
-
0.2.427 Jan 2020Release notes
Open source →Fixed
- generics on
#[tokio::main]function ([#2177]).
Added
- support for
tokio::select!([#2152]).
- generics on
-
0.2.307 Jan 2020Release notes
Open source →Added
- read / write integers using
AsyncReadExtandAsyncWriteExt(#1863). read_buf/write_buffor reading / writingBuf/BufMut(#1881).TcpStream::poll_peek- pollable API for performing TCP peek (#1864).sync::oneshot::error::TryRecvErrorprovides variants to detect the error kind (#1874).LocalSet::block_onaccepts!'statictask (#1882).task::JoinErroris nowSync(#1888).- impl conversions between
tokio::time::Instantandstd::time::Instant(#1904).
Fixes
- read / write integers using
-
0.2.207 Jan 2020 withdrawnRelease notes
Open source →Added
- General refactoring and inclusion of additional runtime options ([#2022] and [#2038])
Release notes
Open source →Fixes
- scheduling with
basic_scheduler(#1861). - update
spawnpanic message to specify that a task scheduler is required (#1839). - API docs example for
runtime::Builderto 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, threaded}_scheduler(#1858).
Added
- impl
Streamforsignal::unix::Signal(#1849). - API docs for platform specific behavior of
signal::ctrl_candsignal::unix::Signal(#1854). - API docs for
signal::unix::Signal::{recv, poll_recv}andsignal::windows::CtrlBreak::{recv, poll_recv}(#1854). File::into_stdandFile::try_into_stdmethods (#1856).
-
0.2.118 Dec 2019Release notes
Open source → -
0.2.026 Nov 2019Release notes
Open 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::spawnreturns aJoinHandle.- 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
bytes0.5 tokio::codecis moved totokio-util.
Removed
- Standalone
timerandnetdrivers are removed, useRuntimeinstead current_threadruntime is removed, usetokio::runtime::Runtimewithbasic_schedulerinstead.
- APIs are updated to use
-
0.2.0-alpha.601 Oct 2019 pre-releaseNothing published for this version
-
0.2.0-alpha.519 Sep 2019 pre-releaseNothing published for this version
-
0.2.0-alpha.429 Aug 2019 pre-releaseNothing published for this version
-
0.2.0-alpha.328 Aug 2019 pre-releaseNothing published for this version
-
0.2.0-alpha.218 Aug 2019 pre-releaseNothing published for this version
-
0.2.0-alpha.108 Aug 2019 pre-releaseNothing published for this version
-
0.0.024 Apr 2019Nothing published for this version