Skip to content
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

xilem_web: Add async_repeat #485

Merged
merged 14 commits into from
Aug 8, 2024
Merged

Conversation

flosse
Copy link
Contributor

@flosse flosse commented Aug 5, 2024

No description provided.

@flosse flosse force-pushed the xilem_web-async_repeat branch from 97709ef to ffd00b2 Compare August 5, 2024 12:01
@flosse

This comment was marked as outdated.

@flosse flosse force-pushed the xilem_web-async_repeat branch from ffd00b2 to 9a4dea0 Compare August 5, 2024 12:24
Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason why this doesn't compile has to do with the two different Message types (as well as DynMessage). One being of xilem_core, which requires Send and the other of xilem_web which doesn't require Send (which is necessary to be interoperable with e.g. web_sys::Event). See other views of xilem_web for more details.

We should probably document this, make it more clear to distinct between those two, because I've also had rust-analyzer suggesting me xilem_core::Message while I did want to use crate::Message.

Hmm the error message is really aweful, I wonder if it's somehow possible to improve this...

xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
@flosse flosse force-pushed the xilem_web-async_repeat branch from 9a4dea0 to 400d934 Compare August 5, 2024 15:13
@flosse
Copy link
Contributor Author

flosse commented Aug 5, 2024

So the reason why this doesn't compile has to do with the two different Message types (as well as DynMessage).

Thank you! Now it works 😄

@Philipp-M
Copy link
Contributor

Thank you! Now it works 😄

Good to know, I hope it's the same issue with AfterBuild etc.

The clippy suggestion is pretty dumb why CI fails... As if an endless loop doesn't have any side-effects...

Anyway, that example is somewhat redundant, as that should be a use-case for the new interval view now.
(Also I don't think we should use async_repeat_raw in an example, it's IMO mostly a hack to be able to capture stuff.)

@flosse
Copy link
Contributor Author

flosse commented Aug 5, 2024

Anyway, that example is somewhat redundant, as that should be a use-case for the new interval view now.

But now I added the "abort handle", that might be specific to async tasks.

@flosse flosse marked this pull request as ready for review August 5, 2024 16:32
@flosse flosse requested a review from Philipp-M August 5, 2024 16:33
Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, looks mostly good, but I think we should strive towards documenting all this stuff at this point

xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
<!DOCTYPE html>
<html>
<head>
<title>Async repeat example | Xilem Web</title>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should call the example different (though it's most descriptive for the view at least), like interval or ping or (news-)ticker as was suggested here, and maybe add the alternative (interval) there as well, so that people don't come to the idea to use async_repeat, when their use case is interval. At the very least, it should mention interval for this use-case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it to spawn_tasks, but that's probably not really appropriate either 🤔

@flosse flosse requested a review from Philipp-M August 5, 2024 22:32
Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart of nits, looks good, nice job with the ShutdownSignal.

xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
xilem_web/src/concurrent/async_repeat.rs Outdated Show resolved Hide resolved
xilem_web/web_examples/spawn_tasks/src/main.rs Outdated Show resolved Hide resolved
@flosse flosse force-pushed the xilem_web-async_repeat branch from b632608 to b010f8f Compare August 7, 2024 22:20
@flosse
Copy link
Contributor Author

flosse commented Aug 7, 2024

Apart of nits, looks good, nice job with the ShutdownSignal.

thank you 😊

@flosse flosse requested a review from Philipp-M August 7, 2024 22:35
Copy link
Contributor

@Philipp-M Philipp-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should've received an invitation to contribute.

Our merge-policy is usually that the author merges (after approval from someone else).

Otherwise looks good, so feel free to merge.

@flosse flosse added this pull request to the merge queue Aug 8, 2024
Merged via the queue into linebender:main with commit 2eda5a2 Aug 8, 2024
17 checks passed
@flosse flosse deleted the xilem_web-async_repeat branch August 8, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants