polachok / tokio-timerfd Goto Github PK
View Code? Open in Web Editor NEWTimerfd for Tokio
Timerfd for Tokio
Hello this is me again
I was considering to add so PS to my previoous issue and then though it would be better on a different topic.
the current constructors of Interval
are at the moment
Interval::new
- initialize with a duration and a start instantInterval::new_interval
- with duration and current instant as start instant. The name isn't much clear but redundant with its struct namewhat about renaming the constructors to:
Interval::new(Duration)
- initialize with a duration and current instant as start instant.Interval::at(Instant, Duration)
or Interval::starting
or Interval::new_starting
- initialize with a duration and a start instant.As a user I think it could be more intuitive and comfortable, what do you think ?
The latest changes to this crate don't appear to be present in the crates.io version, is there a plan to tag a new version?
Hello there
Thank you very much for featuring timerfd
to tokio
, it saved my realtime applications in etherage
At the moment, tokio_timerfd::Interval
can only be used as an async iterator (or close to it, since rust truly supports async iterators) through the trait Stream
, however it does not bring much more than a mere Future
From a user point of view, using Interval
as a Stream
leads to a weird line like this
let interval = Interval::new_interval(...);
interval.next().await.unwrap()?;
as a Future
it could be more straight forward
let interval = Interval::new_interval(...);
interval.await?;
Looking at the current implementation of Stream
, it looks like Future
could be implemented using the exact same code. Do you think an impl Future
could be added mirroring Stream
(or vice-versa) ?
Would you be willing to update this to Tokio 1.x.y? There's a simple implementation here, but it's not released as a crate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.