update dependencies, clippy fixes, metadata
Some checks failed
Rust / build (pull_request) Has been cancelled

This commit is contained in:
Vinzenz Schroeter 2025-05-02 13:43:02 +02:00
parent fdca264ef9
commit 1c9ac90b82
6 changed files with 191 additions and 125 deletions

198
Cargo.lock generated
View file

@ -47,7 +47,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys",
] ]
[[package]] [[package]]
@ -57,7 +57,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"windows-sys 0.52.0", "windows-sys",
] ]
[[package]] [[package]]
@ -68,9 +68,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.5.0" version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]] [[package]]
name = "bitvec" name = "bitvec"
@ -137,16 +137,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]] [[package]]
name = "crossterm" name = "convert_case"
version = "0.27.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" checksum = "bb402b8d4c85569410425650ce3eddc7d698ed96d39a73f941b08fb63082f1e7"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "crossterm"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"crossterm_winapi", "crossterm_winapi",
"libc", "derive_more",
"document-features",
"mio", "mio",
"parking_lot", "parking_lot",
"rustix",
"signal-hook", "signal-hook",
"signal-hook-mio", "signal-hook-mio",
"winapi", "winapi",
@ -161,6 +172,36 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "derive_more"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678"
dependencies = [
"derive_more-impl",
]
[[package]]
name = "derive_more-impl"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [
"convert_case",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "document-features"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
dependencies = [
"litrs",
]
[[package]] [[package]]
name = "env_filter" name = "env_filter"
version = "0.1.0" version = "0.1.0"
@ -184,6 +225,16 @@ dependencies = [
"log", "log",
] ]
[[package]]
name = "errno"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
dependencies = [
"libc",
"windows-sys",
]
[[package]] [[package]]
name = "funty" name = "funty"
version = "2.0.0" version = "2.0.0"
@ -221,9 +272,21 @@ checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.155" version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
[[package]]
name = "litrs"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
@ -249,14 +312,14 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.11" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
"wasi", "wasi",
"windows-sys 0.48.0", "windows-sys",
] ]
[[package]] [[package]]
@ -285,7 +348,7 @@ dependencies = [
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
"windows-targets 0.52.5", "windows-targets",
] ]
[[package]] [[package]]
@ -402,6 +465,19 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "rustix"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.2.0" version = "1.2.0"
@ -423,7 +499,7 @@ dependencies = [
[[package]] [[package]]
name = "servicepoint-life" name = "servicepoint-life"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"clap", "clap",
"crossterm", "crossterm",
@ -445,9 +521,9 @@ dependencies = [
[[package]] [[package]]
name = "signal-hook-mio" name = "signal-hook-mio"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd"
dependencies = [ dependencies = [
"libc", "libc",
"mio", "mio",
@ -518,6 +594,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-segmentation"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]] [[package]]
name = "utf8parse" name = "utf8parse"
version = "0.2.1" version = "0.2.1"
@ -558,37 +640,13 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [ dependencies = [
"windows-targets 0.52.5", "windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
] ]
[[package]] [[package]]
@ -597,46 +655,28 @@ version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm 0.52.5", "windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.52.5", "windows_aarch64_msvc",
"windows_i686_gnu 0.52.5", "windows_i686_gnu",
"windows_i686_gnullvm", "windows_i686_gnullvm",
"windows_i686_msvc 0.52.5", "windows_i686_msvc",
"windows_x86_64_gnu 0.52.5", "windows_x86_64_gnu",
"windows_x86_64_gnullvm 0.52.5", "windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.52.5", "windows_x86_64_msvc",
] ]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.52.5" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.52.5" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.52.5" version = "0.52.5"
@ -649,48 +689,24 @@ version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.52.5" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.52.5" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.52.5" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.52.5" version = "0.52.5"

View file

@ -1,14 +1,20 @@
[package] [package]
name = "servicepoint-life" name = "servicepoint-life"
version = "0.1.0" version = "0.2.0"
edition = "2021" edition = "2021"
license = "GPL-3.0-or-later"
description = "Small terminal app that generates conways game of life rules and simulates them on the servicepoint display."
repository = "https://git.berlin.ccc.de/vinzenz/servicepoint-life"
readme = "README.md"
keywords = ["cccb", "cccb-servicepoint", "conway", "game-of-life", "simulation"]
rust-version = "1.70.0"
[dependencies] [dependencies]
clap = { version = "4.5", features = ["derive"] } clap = { version = "4.5", features = ["derive"] }
rand = "0.8" rand = "0.8"
env_logger = "0.11.3" env_logger = "0.11"
crossterm = "0.27.0" crossterm = "0.29"
log = "0.4.21" log = "0.4"
[dependencies.servicepoint] [dependencies.servicepoint]
package = "servicepoint" package = "servicepoint"
@ -16,3 +22,14 @@ version = "0.14.0"
features = ["rand"] features = ["rand"]
git = "https://git.berlin.ccc.de/servicepoint/servicepoint/" git = "https://git.berlin.ccc.de/servicepoint/servicepoint/"
branch = "next" branch = "next"
[lints.clippy]
incompatible_msrv = "forbid"
[profile.size-optimized]
inherits = "release"
opt-level = 'z' # Optimize for size
lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary

View file

@ -1,5 +1,13 @@
# servicepoint-life # servicepoint-life
More fully featured game of life for the servicepoint display based on the example in the repo. This is a small terminal app that generates conways game of life rules and simulates them on the servicepoint display.
It uses the [servicepoint](https://git.berlin.ccc.de/servicepoint/servicepoint/) library for the display commands.
## Running
With Nix flakes, you can just `nix run git+https://git.berlin.ccc.de/vinzenz/servicepoint-life`.
Otherwise, you can `cargo install --git https://git.berlin.ccc.de/vinzenz/servicepoint-life` and then run `servicepoint-life`.
If you want to poke at the code you can always check out the repo and `cargo run` it.

View file

@ -1,5 +1,5 @@
{ {
description = "Flake for command line interface of the ServicePoint display."; description = "Flake for servicepoint-life";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
@ -71,7 +71,7 @@
rec { rec {
servicepoint-life = { servicepoint-life = {
type = "app"; type = "app";
program = "${selfPkgs.servicepoint-life}/out/servicepoint-life"; program = "${selfPkgs.servicepoint-life}/bin/servicepoint-life";
}; };
default = servicepoint-life; default = servicepoint-life;
} }

View file

@ -11,7 +11,8 @@ where
pub rules: Rules<TState, TKernel, KERNEL_SIZE>, pub rules: Rules<TState, TKernel, KERNEL_SIZE>,
} }
impl<TState: Value + PartialEq, TKernel: Value, const KERNEL_SIZE: usize> Game<TState, TKernel, KERNEL_SIZE> impl<TState: Value + PartialEq, TKernel: Value, const KERNEL_SIZE: usize>
Game<TState, TKernel, KERNEL_SIZE>
{ {
pub fn step(&mut self) { pub fn step(&mut self) {
self.field = self.field_iteration(); self.field = self.field_iteration();

View file

@ -1,22 +1,35 @@
use std::io::stdout; use std::{
use std::net::UdpSocket; io::stdout,
use std::num::Wrapping; net::UdpSocket,
use std::thread; num::Wrapping,
use std::time::{Duration, Instant}; thread,
time::{Duration, Instant},
};
use crate::{
game::Game,
print::{println_debug, println_info, println_warning},
rules::{generate_bb3, generate_u8b3},
};
use clap::Parser; use clap::Parser;
use crossterm::{event, execute}; use crossterm::{
use crossterm::event::{Event, KeyCode, KeyEventKind}; event,
use crossterm::terminal::{ event::{Event, KeyCode, KeyEventKind},
disable_raw_mode, enable_raw_mode, EnableLineWrap, EnterAlternateScreen, LeaveAlternateScreen, execute,
terminal::{
disable_raw_mode, enable_raw_mode, EnableLineWrap, EnterAlternateScreen,
LeaveAlternateScreen,
},
}; };
use log::LevelFilter; use log::LevelFilter;
use rand::distributions::{Distribution, Standard}; use rand::{
use rand::Rng; distributions::{Distribution, Standard},
use servicepoint::{FRAME_PACING, Grid, TILE_HEIGHT, TILE_WIDTH, Bitmap, UdpSocketExt, BitmapCommand, SendCommandExt, BrightnessGridCommand, BrightnessGrid, Brightness, ValueGrid, PIXEL_WIDTH, PIXEL_HEIGHT, ByteGrid}; Rng,
use crate::game::Game; };
use crate::print::{println_debug, println_info, println_warning}; use servicepoint::{
use crate::rules::{generate_bb3, generate_u8b3}; Bitmap, BitmapCommand, Brightness, BrightnessGrid, BrightnessGridCommand, ByteGrid, Grid,
SendCommandExt, UdpSocketExt, ValueGrid, FRAME_PACING, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_HEIGHT,
TILE_WIDTH,
};
mod game; mod game;
mod print; mod print;
@ -149,11 +162,17 @@ fn main() {
} }
Ok(AppEvent::SimulationSpeedUp) => { Ok(AppEvent::SimulationSpeedUp) => {
target_duration = target_duration.saturating_sub(Duration::from_millis(1)); target_duration = target_duration.saturating_sub(Duration::from_millis(1));
println_info(format!("increased simulation speed to {} ups", 1f64 / target_duration.as_secs_f64())); println_info(format!(
"increased simulation speed to {} ups",
1f64 / target_duration.as_secs_f64()
));
} }
Ok(AppEvent::SimulationSpeedDown) => { Ok(AppEvent::SimulationSpeedDown) => {
target_duration = target_duration.saturating_add(Duration::from_millis(1)); target_duration = target_duration.saturating_add(Duration::from_millis(1));
println_info(format!("decreased simulation speed to {} ups", 1f64 / target_duration.as_secs_f64())); println_info(format!(
"decreased simulation speed to {} ups",
1f64 / target_duration.as_secs_f64()
));
} }
} }
} }
@ -218,7 +237,12 @@ impl TryFrom<Event> for AppEvent {
} }
} }
fn draw_pixels(pixels: &mut Bitmap, left: &ValueGrid<bool>, right: &ValueGrid<bool>, split_index: usize) { fn draw_pixels(
pixels: &mut Bitmap,
left: &ValueGrid<bool>,
right: &ValueGrid<bool>,
split_index: usize,
) {
for x in 0..pixels.width() { for x in 0..pixels.width() {
let left_or_right = if x < split_index { left } else { right }; let left_or_right = if x < split_index { left } else { right };
for y in 0..pixels.height() { for y in 0..pixels.height() {
@ -240,10 +264,10 @@ fn draw_luma(luma: &mut BrightnessGrid, left: &ByteGrid, right: &ByteGrid, split
} }
fn send_to_screen(connection: &UdpSocket, pixels: &Bitmap, luma: &BrightnessGrid) { fn send_to_screen(connection: &UdpSocket, pixels: &Bitmap, luma: &BrightnessGrid) {
let cmd: BitmapCommand = pixels.clone().try_into().unwrap(); let cmd: BitmapCommand = pixels.clone().into();
_ = connection.send_command(cmd); connection.send_command(cmd).unwrap();
let cmd: BrightnessGridCommand = luma.clone().try_into().unwrap(); let cmd: BrightnessGridCommand = luma.clone().into();
_ = connection.send_command(cmd); connection.send_command(cmd).unwrap();
} }
fn randomize<TGrid, TValue>(field: &mut TGrid) fn randomize<TGrid, TValue>(field: &mut TGrid)