-
Notifications
You must be signed in to change notification settings - Fork 173
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
refactor!: avoid using futures crate directly #2117
Conversation
88facb2
to
975c903
Compare
What about we do an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd be -1 on iroh_base::futures.
Maybe it's worth seeing if we can get futures denied by cargo-deny?
6344bf8
to
65b277f
Compare
65b277f
to
6ee446b
Compare
is this still alive? should we get it done? |
this is blocked on n0-computer/quic-rpc#71 |
@dignifiedquire I pushed a fix to your compile errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you could constrain futures_lite to the imports. But if you do use futures_lite::future that collides with the import of std::future that you sometimes have to do to use the anemic standardized futures api. So 🤷. If futures_lite would reexport the std futures stuff this would not be an issue, but I guess they did not want to do that.
Also I really don't get what was wrong with the BoxFuture and BoxStream type aliases in futures.
@@ -250,15 +253,6 @@ impl<D: BaoStore> Node<D> { | |||
} | |||
} | |||
|
|||
/// The future completes when the spawned tokio task finishes. | |||
impl<D> Future for Node<D> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind losing this at all.
Due to the low maintenance and absurd high amount of `unsafe` code in parts of the `futures` crate, we are trying to avoid usage of it. Usages are replaced with - `futures-lite` : general `Future` and `Stream` tooling - `futures-sink`: `Sink` trait - `futures-buffered`: faster and safer version of `Futures{Un}Ordered` - If must be `futures-util` for sink specific things that are missing ## Breaking Changes - `iroh::node::Node` does not implement `Future` anymore - `iroh::node::Node::shutdown()` is now `async` and can be awaited upon to wait for the node to exit - `iroh_net::util::AbortingJoinHandle`s inner field is not public anymore, use the `From<JoinHandle>` implementation to contruct it ## Followups - [x] Apply this to `bao-tree`: n0-computer/bao-tree#49 - [x] Apply this to `iroh-io`: n0-computer/iroh-io#6 - [x] Apply this to `quic-rpc`: n0-computer/quic-rpc#73 --------- Co-authored-by: Ruediger Klaehn <[email protected]>
Due to the low maintenance and absurd high amount of
unsafe
code in parts of thefutures
crate, we are trying to avoid usage of it.Usages are replaced with
futures-lite
: generalFuture
andStream
toolingfutures-sink
:Sink
traitfutures-buffered
: faster and safer version ofFutures{Un}Ordered
futures-util
for sink specific things that are missingBreaking Changes
iroh::node::Node
does not implementFuture
anymoreiroh::node::Node::shutdown()
is nowasync
and can be awaited upon to wait for the node to exitiroh_net::util::AbortingJoinHandle
s inner field is not public anymore, use theFrom<JoinHandle>
implementation to contruct itFollowups
bao-tree
: refactor: use futures-lite instead of futures bao-tree#49iroh-io
: refactor: replace futures with futures-lite iroh-io#6quic-rpc
: refactor: no more futures crate quic-rpc#73