Compare commits

..

3 Commits

Author SHA1 Message Date
Oystein Kristoffer Tveit 7470a59404
WIP: add tests 2024-04-19 00:13:27 +02:00
Oystein Kristoffer Tveit dbfe543f59
nix support 2024-04-19 00:12:05 +02:00
Oystein Kristoffer Tveit 61e20f4923
Make entire project async
This moves all communication with Mpv's unix socket into another tokio
task, and uses message passing through clonable mpsc channels to receive
commands to execute, and to send responses.
2024-04-19 00:12:04 +02:00
2 changed files with 4 additions and 13 deletions

View File

@ -14,14 +14,14 @@ rust-version = "1.75"
serde_json = "1.0.104"
log = "0.4.19"
serde = { version = "1.0.197", features = ["derive"] }
# TODO: downscale features once implementation is stable
tokio = { version = "1.37.0", features = ["full"] }
tokio = { version = "1.37.0", features = ["sync", "macros", "rt", "net"] }
tokio-util = { version = "0.7.10", features = ["codec"] }
futures = "0.3.30"
[dev-dependencies]
env_logger = "0.10.0"
test-log = "0.2.15"
tokio = { version = "1.37.0", features = ["rt-multi-thread", "time"] }
[lib]
doctest = false
doctest = false

View File

@ -291,18 +291,9 @@ pub struct Mpv {
command_sender: tokio::sync::mpsc::Sender<(MpvIpcCommand, oneshot::Sender<MpvIpcResponse>)>,
}
// impl Drop for Mpv {
// fn drop(&mut self) {
// self.disconnect();
// }
// }
impl fmt::Debug for Mpv {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
// TODO:
fmt.debug_struct("Mpv")
.field("name", &"TODO: name")
.finish()
fmt.debug_struct("Mpv").finish()
}
}