Skip to content

Commit c97bbee

Browse files
committed
properly implement "null" platform
1 parent 54d9171 commit c97bbee

File tree

4 files changed

+65
-4
lines changed

4 files changed

+65
-4
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[package]
2-
name = "system-media"
3-
version = "0.1.0"
2+
name = "system_media"
3+
version = "0.1.5"
44
edition = "2024"
55

6+
exclude = ["examples/*"]
7+
68
authors = ["William Gibbs <[email protected]>"]
79
description = "Rust crate for interacting with the NowPlaying API"
810
license = "MIT"

build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ fn main() {
3232
println!("cargo:rustc-link-search=native={}", out_dir);
3333
println!("cargo:rustc-link-lib=static=swiftlib");
3434
}
35+
36+
#[cfg(not(any(target_os = "macos")))]
37+
fn main() {}

src/null/mod.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1+
use crate::{MediaBackend, MediaType};
2+
use std::error::Error;
13

4+
pub struct NullBackend;
5+
6+
impl NullBackend {
7+
pub fn new() -> Self {
8+
Self
9+
}
10+
}
11+
12+
impl MediaBackend for NullBackend {
13+
fn set_title(&self, title: &str) {
14+
unimplemented!("system-media currently only supports macOS.");
15+
}
16+
17+
fn set_artist(&self, artist: &str) {
18+
unimplemented!("system-media currently only supports macOS.");
19+
}
20+
21+
fn set_album(&self, album: &str) {
22+
unimplemented!("system-media currently only supports macOS.");
23+
}
24+
25+
fn set_genre(&self, genre: &str) {
26+
unimplemented!("system-media currently only supports macOS.");
27+
}
28+
29+
fn set_image(&self, path: &str) -> Result<(), Box<dyn Error>> {
30+
unimplemented!("system-media currently only supports macOS.")
31+
}
32+
33+
fn set_media_type(&self, media_type: MediaType) {
34+
unimplemented!("system-media currently only supports macOS.");
35+
}
36+
37+
fn set_playback_duration(&self, duration: f64) {
38+
unimplemented!("system-media currently only supports macOS.");
39+
}
40+
41+
fn set_elapsed_duration(&self, duration: f64) {
42+
unimplemented!("system-media currently only supports macOS.");
43+
}
44+
45+
fn set_playback_rate(&self, rate: f64) {
46+
unimplemented!("system-media currently only supports macOS.");
47+
}
48+
49+
fn start_session(&self) {
50+
unimplemented!("system-media currently only supports macOS.");
51+
}
52+
53+
fn stop_session(&self) {
54+
unimplemented!("system-media currently only supports macOS.");
55+
println!("how do we stop a session?");
56+
}
57+
}

0 commit comments

Comments
 (0)