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

Conversion to async #28

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversion to async #28

wants to merge 9 commits into from

Conversation

g2p
Copy link
Contributor

@g2p g2p commented Mar 7, 2024

Here is a branch that converts rust-cast to an async message stream. The interesting changes are in src/message_manager.rs (going from Read+Write to AsyncRead+AsyncWrite) and src/lib.rs (connecting is changed to use tokio-rustls); the rest is simple changes from fns to async fns. Sending and receiving won't block each other.

It is on top of my other patches; to review the async changes, please look at g2p/queue-load...g2p/async

Draft for now because the latest release of tokio-rustls is behind the current version of rustls (which rust-cast uses), and for now Cargo.toml points to the main branch of tokio-rustls.

@g2p g2p marked this pull request as draft March 7, 2024 14:28
@g2p g2p mentioned this pull request Mar 7, 2024
@g2p g2p force-pushed the async branch 2 times, most recently from cbf3897 to 5b1a75a Compare March 11, 2024 12:48
g2p added 8 commits March 19, 2024 14:30
It is possible to get by with matches!, but this is more convenient.
On the JS sender side at least, Session.queueLoad is deprecated
in favour of Session.load with a queueData set on the loaded item.
This is useful to know when the player appears to be idle
but is in fact loading the next track from a playlist.
Also, introduce the TryFrom trait and new error types.
This removes all uses of unwrap from media.rs.
Queue item currently playing, loading, preloaded.
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.

1 participant