diff --git a/Cargo.lock b/Cargo.lock index 5f45fac..9f6627e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,15 +17,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "announce" -version = "0.1.0" -dependencies = [ - "clap 4.5.4", - "env_logger", - "servicepoint", -] - [[package]] name = "anstream" version = "0.6.14" @@ -250,29 +241,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "env_filter" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - [[package]] name = "errno" version = "0.3.9" @@ -299,16 +267,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "game_of_life" -version = "0.1.0" -dependencies = [ - "clap 4.5.4", - "env_logger", - "rand", - "servicepoint", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -347,12 +305,6 @@ dependencies = [ "libc", ] -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "indexmap" version = "1.9.3" @@ -425,15 +377,6 @@ dependencies = [ "adler", ] -[[package]] -name = "moving_line" -version = "0.1.0" -dependencies = [ - "clap 4.5.4", - "env_logger", - "servicepoint", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -506,16 +449,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "random_brightness" -version = "0.1.0" -dependencies = [ - "clap 4.5.4", - "env_logger", - "rand", - "servicepoint", -] - [[package]] name = "regex" version = "1.10.4" @@ -610,8 +543,10 @@ name = "servicepoint" version = "0.4.2" dependencies = [ "bzip2", + "clap 4.5.4", "flate2", "log", + "rand", "rust-lzma", "zstd", ] @@ -831,15 +766,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" -[[package]] -name = "wiping_clear" -version = "0.1.0" -dependencies = [ - "clap 4.5.4", - "env_logger", - "servicepoint", -] - [[package]] name = "zstd" version = "0.13.1" diff --git a/Cargo.toml b/Cargo.toml index 9159b88..787ddeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,5 @@ members = [ "crates/servicepoint", "crates/servicepoint_binding_c", "crates/servicepoint_binding_cs", - "examples/announce", - "examples/game_of_life", - "examples/moving_line", - "examples/wiping_clear", - "examples/random_brightness", - "examples/lang_c" + "crates/servicepoint_binding_c/examples/lang_c" ] diff --git a/crates/servicepoint/Cargo.toml b/crates/servicepoint/Cargo.toml index 9e0905b..e8b858b 100644 --- a/crates/servicepoint/Cargo.toml +++ b/crates/servicepoint/Cargo.toml @@ -26,3 +26,8 @@ compression_bzip2 = ["dep:bzip2"] compression_lzma = ["dep:rust-lzma"] compression_zstd = ["dep:zstd"] all_compressions = ["compression_zlib", "compression_bzip2", "compression_lzma", "compression_zstd"] + +[dev-dependencies] +# for examples +clap = { version = "4.5", features = ["derive"] } +rand = "0.8" \ No newline at end of file diff --git a/examples/announce/src/main.rs b/crates/servicepoint/examples/announce.rs similarity index 89% rename from examples/announce/src/main.rs rename to crates/servicepoint/examples/announce.rs index a1fb81e..31d19d2 100644 --- a/examples/announce/src/main.rs +++ b/crates/servicepoint/examples/announce.rs @@ -14,10 +14,11 @@ struct Cli { /// example: `cargo run -- --text "Hallo, /// CCCB"` - fn main() { - env_logger::init(); - let cli = Cli::parse(); + let mut cli = Cli::parse(); + if cli.text.is_empty() { + cli.text.push("Hello, CCCB!".to_string()); + } let connection = Connection::open(&cli.destination).unwrap(); if cli.clear { diff --git a/examples/game_of_life/src/main.rs b/crates/servicepoint/examples/game_of_life.rs similarity index 90% rename from examples/game_of_life/src/main.rs rename to crates/servicepoint/examples/game_of_life.rs index dae06f4..aef929e 100644 --- a/examples/game_of_life/src/main.rs +++ b/crates/servicepoint/examples/game_of_life.rs @@ -14,7 +14,6 @@ struct Cli { } fn main() { - env_logger::init(); let cli = Cli::parse(); let connection = Connection::open(&cli.destination).unwrap(); @@ -22,13 +21,11 @@ fn main() { loop { connection - .send( - Command::BitmapLinearWin( - Origin(0, 0), - field.clone(), - CompressionCode::Lzma, - ) - ) + .send(Command::BitmapLinearWin( + Origin(0, 0), + field.clone(), + CompressionCode::Lzma, + )) .expect("could not send"); thread::sleep(FRAME_PACING); field = iteration(field); diff --git a/examples/moving_line/src/main.rs b/crates/servicepoint/examples/moving_line.rs similarity index 71% rename from examples/moving_line/src/main.rs rename to crates/servicepoint/examples/moving_line.rs index 5e812f7..2037146 100644 --- a/examples/moving_line/src/main.rs +++ b/crates/servicepoint/examples/moving_line.rs @@ -11,8 +11,6 @@ struct Cli { } fn main() { - env_logger::init(); - let connection = Connection::open(Cli::parse().destination).unwrap(); let mut pixels = PixelGrid::max_sized(); @@ -23,13 +21,11 @@ fn main() { pixels.set((y + x_offset) % PIXEL_WIDTH, y, true); } connection - .send( - Command::BitmapLinearWin( - Origin(0, 0), - pixels.clone(), - CompressionCode::Lzma, - ) - ) + .send(Command::BitmapLinearWin( + Origin(0, 0), + pixels.clone(), + CompressionCode::Lzma, + )) .unwrap(); thread::sleep(FRAME_PACING); } diff --git a/examples/random_brightness/src/main.rs b/crates/servicepoint/examples/random_brightness.rs similarity index 93% rename from examples/random_brightness/src/main.rs rename to crates/servicepoint/examples/random_brightness.rs index b4194e8..7e3c4e8 100644 --- a/examples/random_brightness/src/main.rs +++ b/crates/servicepoint/examples/random_brightness.rs @@ -17,7 +17,6 @@ struct Cli { } fn main() { - env_logger::init(); let cli = Cli::parse(); let connection = Connection::open(cli.destination).unwrap(); @@ -55,9 +54,7 @@ fn main() { } } - connection - .send(CharBrightness(origin, luma)) - .unwrap(); + connection.send(CharBrightness(origin, luma)).unwrap(); std::thread::sleep(wait_duration); } } diff --git a/examples/wiping_clear/src/main.rs b/crates/servicepoint/examples/wiping_clear.rs similarity index 88% rename from examples/wiping_clear/src/main.rs rename to crates/servicepoint/examples/wiping_clear.rs index 7e5d0be..3f255d8 100644 --- a/examples/wiping_clear/src/main.rs +++ b/crates/servicepoint/examples/wiping_clear.rs @@ -14,7 +14,6 @@ struct Cli { } fn main() { - env_logger::init(); let cli = Cli::parse(); let sleep_duration = Duration::max( @@ -37,9 +36,7 @@ fn main() { let bit_vec = BitVec::from(&*pixel_data); connection - .send( - Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma) - ) + .send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma)) .unwrap(); thread::sleep(sleep_duration); } diff --git a/examples/lang_c/Cargo.toml b/crates/servicepoint_binding_c/examples/lang_c/Cargo.toml similarity index 66% rename from examples/lang_c/Cargo.toml rename to crates/servicepoint_binding_c/examples/lang_c/Cargo.toml index 9792416..4997310 100644 --- a/examples/lang_c/Cargo.toml +++ b/crates/servicepoint_binding_c/examples/lang_c/Cargo.toml @@ -11,4 +11,4 @@ test = false cc = "1.0" [dependencies] -servicepoint_binding_c = { path = "../../crates/servicepoint_binding_c" } +servicepoint_binding_c = { path = "../.." } diff --git a/examples/lang_c/Makefile b/crates/servicepoint_binding_c/examples/lang_c/Makefile similarity index 100% rename from examples/lang_c/Makefile rename to crates/servicepoint_binding_c/examples/lang_c/Makefile diff --git a/examples/lang_c/build.rs b/crates/servicepoint_binding_c/examples/lang_c/build.rs similarity index 100% rename from examples/lang_c/build.rs rename to crates/servicepoint_binding_c/examples/lang_c/build.rs diff --git a/examples/lang_c/include/servicepoint.h b/crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h similarity index 100% rename from examples/lang_c/include/servicepoint.h rename to crates/servicepoint_binding_c/examples/lang_c/include/servicepoint.h diff --git a/crates/servicepoint_binding_c/examples/lang_c/src/lib.rs b/crates/servicepoint_binding_c/examples/lang_c/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/crates/servicepoint_binding_c/examples/lang_c/src/lib.rs @@ -0,0 +1 @@ + diff --git a/examples/lang_c/src/main.c b/crates/servicepoint_binding_c/examples/lang_c/src/main.c similarity index 100% rename from examples/lang_c/src/main.c rename to crates/servicepoint_binding_c/examples/lang_c/src/main.c diff --git a/examples/lang_cs/Program.cs b/crates/servicepoint_binding_cs/examples/lang_cs/Program.cs similarity index 100% rename from examples/lang_cs/Program.cs rename to crates/servicepoint_binding_cs/examples/lang_cs/Program.cs diff --git a/examples/lang_cs/lang_cs.csproj b/crates/servicepoint_binding_cs/examples/lang_cs/lang_cs.csproj similarity index 100% rename from examples/lang_cs/lang_cs.csproj rename to crates/servicepoint_binding_cs/examples/lang_cs/lang_cs.csproj diff --git a/examples/announce/Cargo.toml b/examples/announce/Cargo.toml deleted file mode 100644 index 0b9ceed..0000000 --- a/examples/announce/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "announce" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -servicepoint = { path = "../../crates/servicepoint" } -clap = { version = "4.5", features = ["derive"] } -env_logger = "0.11" diff --git a/examples/game_of_life/Cargo.toml b/examples/game_of_life/Cargo.toml deleted file mode 100644 index df05972..0000000 --- a/examples/game_of_life/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "game_of_life" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -servicepoint = { path = "../../crates/servicepoint" } -clap = { version = "4.5", features = ["derive"] } -env_logger = "0.11" - -rand = "0.8.5" diff --git a/examples/lang_c/src/lib.rs b/examples/lang_c/src/lib.rs deleted file mode 100644 index e69de29..0000000 diff --git a/examples/moving_line/Cargo.toml b/examples/moving_line/Cargo.toml deleted file mode 100644 index 23645de..0000000 --- a/examples/moving_line/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "moving_line" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -servicepoint = { path = "../../crates/servicepoint" } -clap = { version = "4.5", features = ["derive"] } -env_logger = "0.11" diff --git a/examples/random_brightness/Cargo.toml b/examples/random_brightness/Cargo.toml deleted file mode 100644 index 4330960..0000000 --- a/examples/random_brightness/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "random_brightness" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -servicepoint = { path = "../../crates/servicepoint" } -clap = { version = "4.5", features = ["derive"] } -env_logger = "0.11" - -rand = "0.8" diff --git a/examples/wiping_clear/Cargo.toml b/examples/wiping_clear/Cargo.toml deleted file mode 100644 index 7ba5c58..0000000 --- a/examples/wiping_clear/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "wiping_clear" -version = "0.1.0" -edition = "2021" -publish = false - -[dependencies] -servicepoint = { path = "../../crates/servicepoint" } -clap = { version = "4.5", features = ["derive"] } -env_logger = "0.11"