-
Notifications
You must be signed in to change notification settings - Fork 6
chore: migrate to rust edition 2024, align formatting with iroh standards #90
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
Open
Frando
wants to merge
9
commits into
main
Choose a base branch
from
Frando/edition2024
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
80d7bcb
chore: migrate to rust edition 2024
Frando 4ce45fe
chore: clippy
Frando 1ac182a
chore: fmt
Frando b2c0f83
chore: fmt
Frando d9827d3
allow to use Result type alias for all results
Frando 151d34f
fixup
Frando a7a471a
ensure consistent formatting
Frando f1e51a9
fixup fmt
Frando 331ba8a
add docs about formatting
Frando File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1012,11 +1012,11 @@ pub mod channel { | |
| value: U, | ||
| ) -> Pin<Box<dyn Future<Output = Result<(), SendError>> + Send + '_>> { | ||
| Box::pin(async move { | ||
| if let Some(v) = (self.f)(value) { | ||
| match (self.f)(value) { Some(v) => { | ||
| self.sender.send(v).await | ||
| } else { | ||
| } _ => { | ||
| Ok(()) | ||
| } | ||
| }} | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -1025,11 +1025,11 @@ pub mod channel { | |
| value: U, | ||
| ) -> Pin<Box<dyn Future<Output = Result<bool, SendError>> + Send + '_>> { | ||
| Box::pin(async move { | ||
| if let Some(v) = (self.f)(value) { | ||
| match (self.f)(value) { Some(v) => { | ||
| self.sender.try_send(v).await | ||
| } else { | ||
| } _ => { | ||
| Ok(true) | ||
| } | ||
| }} | ||
|
||
| }) | ||
| } | ||
|
|
||
|
|
@@ -1349,7 +1349,7 @@ impl<S: Service> Client<S> { | |
| &self, | ||
| ) -> impl Future< | ||
| Output = result::Result<Request<LocalSender<S>, rpc::RemoteSender<S>>, RequestError>, | ||
| > + 'static { | ||
| > + 'static + use<S> { | ||
| #[cfg(feature = "rpc")] | ||
| { | ||
| let cloned = match &self.0 { | ||
|
|
@@ -1377,7 +1377,7 @@ impl<S: Service> Client<S> { | |
| } | ||
|
|
||
| /// Performs a request for which the server returns a oneshot receiver. | ||
| pub fn rpc<Req, Res>(&self, msg: Req) -> impl Future<Output = Result<Res>> + Send + 'static | ||
| pub fn rpc<Req, Res>(&self, msg: Req) -> impl Future<Output = Result<Res>> + Send + 'static + use<Req, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1410,7 +1410,7 @@ impl<S: Service> Client<S> { | |
| &self, | ||
| msg: Req, | ||
| local_response_cap: usize, | ||
| ) -> impl Future<Output = Result<mpsc::Receiver<Res>>> + Send + 'static | ||
| ) -> impl Future<Output = Result<mpsc::Receiver<Res>>> + Send + 'static + use<Req, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1442,7 +1442,7 @@ impl<S: Service> Client<S> { | |
| &self, | ||
| msg: Req, | ||
| local_update_cap: usize, | ||
| ) -> impl Future<Output = Result<(mpsc::Sender<Update>, oneshot::Receiver<Res>)>> | ||
| ) -> impl Future<Output = Result<(mpsc::Sender<Update>, oneshot::Receiver<Res>)>> + use<Req, Update, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1478,7 +1478,7 @@ impl<S: Service> Client<S> { | |
| msg: Req, | ||
| local_update_cap: usize, | ||
| local_response_cap: usize, | ||
| ) -> impl Future<Output = Result<(mpsc::Sender<Update>, mpsc::Receiver<Res>)>> + Send + 'static | ||
| ) -> impl Future<Output = Result<(mpsc::Sender<Update>, mpsc::Receiver<Res>)>> + Send + 'static + use<Req, Update, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1511,7 +1511,7 @@ impl<S: Service> Client<S> { | |
| /// Performs a request for which the server returns nothing. | ||
| /// | ||
| /// The returned future completes once the message is sent. | ||
| pub fn notify<Req>(&self, msg: Req) -> impl Future<Output = Result<()>> + Send + 'static | ||
| pub fn notify<Req>(&self, msg: Req) -> impl Future<Output = Result<()>> + Send + 'static + use<Req, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1541,7 +1541,7 @@ impl<S: Service> Client<S> { | |
| /// Compared to [Self::notify], this variant takes a future that returns true | ||
| /// if 0rtt has been accepted. If not, the data is sent again via the same | ||
| /// remote channel. For local requests, the future is ignored. | ||
| pub fn notify_0rtt<Req>(&self, msg: Req) -> impl Future<Output = Result<()>> + Send + 'static | ||
| pub fn notify_0rtt<Req>(&self, msg: Req) -> impl Future<Output = Result<()>> + Send + 'static + use<Req, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1578,7 +1578,7 @@ impl<S: Service> Client<S> { | |
| /// Compared to [Self::rpc], this variant takes a future that returns true | ||
| /// if 0rtt has been accepted. If not, the data is sent again via the same | ||
| /// remote channel. For local requests, the future is ignored. | ||
| pub fn rpc_0rtt<Req, Res>(&self, msg: Req) -> impl Future<Output = Result<Res>> + Send + 'static | ||
| pub fn rpc_0rtt<Req, Res>(&self, msg: Req) -> impl Future<Output = Result<Res>> + Send + 'static + use<Req, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -1627,7 +1627,7 @@ impl<S: Service> Client<S> { | |
| &self, | ||
| msg: Req, | ||
| local_response_cap: usize, | ||
| ) -> impl Future<Output = Result<mpsc::Receiver<Res>>> + Send + 'static | ||
| ) -> impl Future<Output = Result<mpsc::Receiver<Res>>> + Send + 'static + use<Req, Res, S> | ||
| where | ||
| S: From<Req>, | ||
| S::Message: From<WithChannels<Req, S>>, | ||
|
|
@@ -2525,7 +2525,7 @@ impl<S: Service> LocalSender<S> { | |
| pub fn send_raw( | ||
| &self, | ||
| value: S::Message, | ||
| ) -> impl Future<Output = std::result::Result<(), SendError>> + Send + 'static { | ||
| ) -> impl Future<Output = std::result::Result<(), SendError>> + Send + 'static + use<S> { | ||
| let x = self.0.clone(); | ||
| async move { x.send(value).await } | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This seems weird? :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.
Uh yeah, reran fmt, dunno what was going on there