-
Notifications
You must be signed in to change notification settings - Fork 185
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: Use n0-future
in favor of futures-*
libraries and tokio::{spawn,task,time}
#3156
Conversation
iroh/src/discovery/pkarr.rs
Outdated
let republish = tokio::time::sleep(Duration::MAX); | ||
tokio::pin!(republish); | ||
let republish = time::sleep(Duration::MAX); | ||
n0_future::pin!(republish); |
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.
nit: the pin macro exists in the std lib
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.
TIL
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.
Seems like it doesn't work though. If I use std::pin::pin!(republish)
it doesn't compile for me 🤔
We need `flatten_stream`, which isn't re-exported in n0-future.
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3156/docs/iroh/ Last updated: 2025-01-29T15:28:14Z |
Description
futures_lite
,futures_util
,futures_sink
andfutures_buffered
with re-exports fromn0_future
.std::time
withn0_future::time
tokio::{spawn,task,time}
withn0_future::{spawn,task,time}
tokio::time::advance
that we don't have n0-future yet. It's also not strictly necessary for shipping e.g. browser stuff.The goal of this PR is
Essentially this is work extracted out of the browser PRs.
Breaking Changes
I don't think there are any breaking changes from this.
It's possible that
JoinSet
orJoinHandle
types leak from the interfaces somewhere, but they're identical to the old ones (just re-exports) outside ofwasm*-*-unknown
targets.Notes & open questions
I've tried setting up semgrep, but (1) IIUC, setting it up for CI requires that you have an account with them, only running locally is free and (2) I haven't found a way to ignore e.g.
std::time
imports when you're inside a*::tests
module, which means we'd either need to convert all our tests ton0-future
or ignore warnings and I think both of these options might suck.Change checklist