Commit Graph
37 Commits
Author SHA1 Message Date
Mattia Pitossi ab3996a6dd time: update outdated docs of Wheel (#7749) 2025-11-29 18:06:33 +08:00
Lucas Black 8ccf2fb92e ci: unfreeze wasm tests from rustc 1.88.0 (#7537) 2025-09-26 21:29:01 +08:00
Daniel Sharifi adc3e19ba7 time: clarify the cancellation safety of the DelayQueue (#7564) 2025-08-31 20:57:17 +08:00
yanyuxing 0e5c5d64f5 future: add adapters of CancellationToken for FutureExt (#7475) 2025-07-29 18:09:13 +08:00
Aaron Chen a7896d07f1 chore: update CI to clippy 1.88 (#7452) 2025-07-09 08:34:24 +02:00
David Herberth bce9780dd3 time: use array::from_fn instead of manually creating array (#7000) 2024-12-01 19:54:30 +01:00
Hamir Mahal d4178cf349 tokio: avoid positional fmt params when possible (#6978) 2024-11-18 13:50:58 +01:00
Nur 29cd6ec1ec time: import Future trait from std instead of futures_core (#6884) 2024-10-07 14:13:09 +02:00
Motoyuki Kimura 09bc9a05e4 chore: use boxed slice if possible (#6858) 2024-09-25 19:45:28 +09:00
Havish Maka 11f66f43a0 chore: replace ready! with std::task::ready! (#6804) 2024-08-29 22:02:56 +02:00
Adam Cigánek 1e798d26ed time: wake DelayQueue when removing last item (#6752) 2024-08-06 16:22:31 +02:00
Michael Scholten daa89017da ci: fix new clippy warnings (#6569) 2024-05-18 10:09:37 +02:00
Evan Rittenhouse bfd7b08067 time: add FutureExt::timeout (#6276) 2024-01-16 09:51:38 +01:00
Taiki Endo 84c5674c60 ci: update clippy version to 1.75 (#6273) 2024-01-07 02:33:37 +09:00
aliu a8e8fa6681 time: add DelayQueue::deadline (#6163) 2023-11-23 18:20:26 +01:00
isabelleatkins 9f9e596eec time: fix panic in DelayQueue (#5630) 2023-04-17 20:51:42 +00:00
Jens Reidel effead29d1 time: add DelayQueue::peek (#5569)
Signed-off-by: Jens Reidel <[email protected]>
2023-04-16 09:43:03 +02:00
Daniel Sedlak d4afbad6e5 tokio: fix typos (#5604) 2023-04-06 14:29:12 +02:00
Alice Ryhl fc9518b627 chore: bump clippy version (#5173) 2022-11-06 12:44:26 +01:00
Erwan e8354279fb time: add DelayQueue::try_remove (#5052) 2022-09-28 07:50:00 +00:00
Josh Soref f3e340a35b chore: fix spelling mistakes (#4858)
Signed-off-by: Josh Soref <[email protected]>
2022-07-25 07:26:01 +00:00
Hayden Stainsby ad412a9833 util: add track_caller to public APIs (#4785)
* util: add track_caller to public APIs

Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds `#[track_caller]` to all the non-unstable public APIs in
tokio-util where the documentation describes how the function may panic
due to incorrect context or inputs.

In one place, an assert was added where the described behavior appeared
not to be implemented. The documentation for `DelayQueue::reserve`
states that the function will panic if the new capacity exceeds the
maximum number of entries the queue can contain. However, the function
didn't panic until a higher number caused by an allocation failure. This
is inconsistent with `DelayQueue::insert_at` which will panic if the
number of entries were to go over MAX_ENTRIES.

Tests are included to cover each potentially panicking function.

Refs: #4413

* fix tests on FreeBSD 32-bit (I hope)

Some tests were failing on FreeBSD 32-bit because the "times too far in
the future" for DelayQueue were also too far in the future for the OS.

Fixed by copying the MAX_DURATION value from where it's defined and
using it to create a duration that is just 1 more than the maximum. This
will start to break once we get close (within 2 and a bit years) of the
Epochalypse (19 Jan, 2038) - but a lot of other things are going to be
breaking on FreeBSD 32-bit by then anyway.
2022-06-27 12:31:31 +02:00
Benjamin Saunders cf38ba627a util: remove error case from the infallible DelayQueue::poll_elapsed (#4241) 2022-02-08 21:07:33 -05:00
b-naber c800deaacc util: add shrink_to_fit and compact methods to DelayQueue (#4170) 2022-01-09 12:41:30 +01:00
Alice Ryhl e04b5be1f5 time: update deadline on removal in DelayQueue (#4178) 2021-10-22 20:34:36 +02:00
Toby Lawrence 23b0aee5dd tokio-util: expose key used in DelayQueue's Expired (#4081)
Signed-off-by: Toby Lawrence <[email protected]>
2021-08-31 17:09:10 -04:00
Aaron Taner ce9ca45c92 doc: fix invalid #[doc(inline)] warnings on latest nightly. (#3788)
This commit fixed issue #3787 by removing [doc(inline)] from
macro `cfg_macros` and added proper #[doc(inline)] attributes
to `pub use` items inside `cfg_macros` calls.

It's probably not `cfg_macros`s responsibility to inlining public
macros, though it's conveninent to do so. Notice that in lib.rs:

cfg_macros! {
    /// Implementation detail of the `select!` macro. This macro is **not**
    /// intended to be used as part of the public API and is permitted to
    /// change.
    #[doc(hidden)]
    pub use tokio_macros::select_priv_declare_output_enum;

    ...
}

`#[doc(hidden)]` and `#[doc(inline)]` are conflict with each other
in the sense of correctness.

Fixes: #3787
2021-05-18 01:28:17 +09:00
David Pedersen 81f47e8866 util: fix indentation and typos in DelayQueue docs (#3626) 2021-03-20 14:31:12 +01:00
William Bain c4f66ed121 util: fix panics on updating DelayQueue entries (#3270) 2021-01-21 10:56:44 +01:00
Rust大闸蟹 e42317b072 chore: remove macro_rules semicolon (#3381)
fix build warning
2021-01-06 15:46:37 +09:00
Carl Lerche d74d17307d time: remove Box from Sleep (#3278)
Removes the box from `Sleep`, taking advantage of intrusive wakers. The
`Sleep` future is now `!Unpin`.

Closes #3267
2020-12-16 21:51:34 -08:00
bdonlan ae67851f11 time: use intrusive lists for timer tracking (#3080)
More-or-less a half-rewrite of the current time driver, supporting the
use of intrusive futures for timer registration.

Fixes: #3028, #3069
2020-11-23 10:42:50 -08:00
Akira Hayakawa e309da0bee util: remove stream feature flag from DelayQueue (#3087) 2020-11-03 09:20:24 +01:00
Juan Alvarez 0893841f31 time: move error types into time::error (#2938) 2020-10-12 10:21:44 -07:00
Juan Alvarez 60d81bbe10 time: rename Delay future to Sleep (#2932) 2020-10-08 20:35:12 -07:00
greenwoodcm fcdf9345bf time: clean time driver (#2905)
* remove unnecessary wheel::Poll

the timer wheel uses the `wheel::Poll` struct as input when
advancing the timer to the next time step.  the `Poll` struct
contains an instant representing the time step to advance to
and also contains an optional and mutable reference to an
`Expiration` struct.  from what I can tell, the latter field
is only used in the context of polling the wheel and does not
need to be exposed outside of that method.  without the
expiration field the `Poll` struct is nothing more than a
wrapper around the instant being polled.  this change removes
the `Poll` struct and updates integration points accordingly.

* remove Stack trait in favor of concrete Stack implementation

* remove timer Registration struct
2020-10-06 12:48:01 -07:00
bdonlanandBryan Donlan 9730317e94 time: move DelayQueue to tokio-util (#2897)
This change is intended to do the minimum to unblock 0.3; as such, for now, we
duplicate the internal `time::wheel` structures in tokio-util, rather than trying
to refactor things at this stage.

Co-authored-by: Bryan Donlan <[email protected]>
2020-10-05 14:25:04 -07:00