-
Notifications
You must be signed in to change notification settings - Fork 161
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 |
Unfortunately quic-rpc is using quite a few things from futures
Changing the futures dependency in quic-rpc to futures-lite would mean that it does not play well with crates using the full futures crate anymore, which would be not very nice. Also, if we just use futures-sink instead of futures directly aren't we still depending on code from the futures project? So what do we gain? I can switch quic-rpc to a combination of futures-lite and importing futures-sink. But I seriously don't see the benefit for all the work. I started, but it's a lot. There is no Either in futures_lite, no select, no SinkExt in futures_sink etc. |
@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 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