-
Notifications
You must be signed in to change notification settings - Fork 17
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
Tokio/futures async support #33
Comments
I really like the idea of streaming players. I also like the plan to wait for 0.2. I'm excited! |
Cool. I'll probably catch the guys at dbus-rs somewhere next week, give them the port for 0.2 I was working on. |
FYI, I've dropped my (non working) futures 0.2 code over at dbus-rs diwic/dbus-rs#129 |
FYI 0.2 just shipped, but it seems like it's only meant for experimentation still.
|
Yeh, I read that too. Thing is, we have to |
Would it make more sense to use tokio + dbus's nonblocking support, or to just roll a custom version via callbacks? The second would likely be much easier since it would reuse most of the existing code and also be executor-independent. |
I honestly don't know. I'm not well versed in these ecosystems yet. |
That would not at all integrate in any ecosystem. Callbacks could be useful, but are not an alternative to async-await integration. |
Oh I meant using custom futures implemented via having callbacks update a response value and then waking the waiting future. |
Can't you use channels for that?
I wonder what |
Hey, how is this issue going? Tokio is now version 1.2.0, so maybe it is stable enough to have a look at it again? I'm asking this because: I'm probably not qualified to help with this work, quite new to Rust... :/ (Thank you for the library, it's just what I need! I first thought I had to interact with C calls to control Rhythmbox |
Booting up a thread that just blocks is not very expensive at all afaik, it's how everyone did it before we got async io after all. It might be time to look into it now, but then again it's very hard to support both async and sync io in the same codebase in Rust from what I can tell. Async tends to take over everything and infecting stuff. Async also adds a huge amount of overhead (a whole runtime) and I've heard that the dbus infrastructure works badly with async io because of assumptions (like with OpenGL and multi-threading), but that could be a big misunderstanding from my part. If anyone can come up with a design that allows compile-time toggle of async support (I don't mind if it's default or not), that also allows you to plug in different runtimes (tokio, async-std, etc.), then I would be happy to get it in right now! |
Ok, then I'll just use something like I do know that some crates use options in their Cargo.toml to mark what you want to use. (e.g. But I probably can't help further |
Ha ha, no worries! 🙂 Yeah, that's what I want, without the code becoming too complex to support it. Maybe I'll look into an experimental implementation some day. |
Any update on this? |
No. I've not worked on this project at all since last time. |
I've been working on an async version (ig async wrapper) for this library called mpris-async-rs. It technically is just running another thread that tracks changes and then sends that to a streamer class. It is a little buggy (especially if you disconnect a player and then reopen it, where it crashes) so I haven't put it on crates or anything. I thought I'd mention it here since it seems some people want the feature. I do want to mention that async code that spawns a task can be slightly annoying to code since Player does not implement send (I think because of the Rc<PooledConnection>?) |
I have my own local rewrite that I work on a few hours per year, but that version is async using zbus. If people are interested in helping out, I could publish the branch and accept PRs on it. |
As suggested in #32:
I've been experimenting with porting
dbus-tokio
tofutures
0.2.0, and it seems like its dependency on tokio will get a lot lighter (seems like onlytokio-reactor
will be needed). I suggest that whenever tokio releases their futures 0.2 support, we start implementing this. For now, we can discuss a bit how the interface should look like.One of the things I think would be extremely cool, would be the possibility to "subscribe" to new players coming online. With the current interface, you basically have to query dbus on set intervals for active players. Having something like
PlayerFinder::stream() -> impl Stream<StreamItem=Player>
would be very cool.Secondly, having a
Player
somehow emit events in form of aStream
would be very useful too.The text was updated successfully, but these errors were encountered: