Skip to content
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

Uniffi prerequisites: remove send_mut, add methods for changing whole row/column, make BitVec type alias pub #19

Merged
merged 18 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 52 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ members = [
]

[workspace.package]
version = "0.10.0"
version = "0.11.0"

[workspace.lints.rust]
missing-docs = "warn"

[workspace.dependencies]
thiserror = "1.0.69"
1 change: 1 addition & 0 deletions crates/servicepoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rust-lzma = { version = "0.6.0", optional = true }
rand = { version = "0.8", optional = true }
tungstenite = { version = "0.24.0", optional = true }
once_cell = { version = "1.20.2", optional = true }
thiserror.workspace = true

[features]
default = ["compression_lzma", "protocol_udp", "cp437"]
Expand Down
2 changes: 1 addition & 1 deletion crates/servicepoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cargo add servicepoint
or
```toml
[dependencies]
servicepoint = "0.10.0"
servicepoint = "0.11.0"
```

## Examples
Expand Down
6 changes: 3 additions & 3 deletions crates/servicepoint/examples/announce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ fn main() {
}

let text = cli.text.join("\n");
let grid = CharGrid::from(&*text);
let cp437_grid = Cp437Grid::from(&grid);
let grid = CharGrid::from(text);
let grid = Cp437Grid::from(grid);

connection
.send(Command::Cp437Data(Origin::ZERO, cp437_grid))
.send(Command::Cp437Data(Origin::ZERO, grid))
.expect("sending text failed");
}
9 changes: 3 additions & 6 deletions crates/servicepoint/examples/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ use servicepoint::{
};

fn main() {
// make connection mut
let mut connection =
let connection =
Connection::open_websocket("ws://localhost:8080".parse().unwrap())
.unwrap();

// use send_mut instead of send
connection.send_mut(Command::Clear).unwrap();
connection.send(Command::Clear).unwrap();

let mut pixels = Bitmap::max_sized();
pixels.fill(true);

// use send_mut instead of send
connection
.send_mut(Command::BitmapLinearWin(
.send(Command::BitmapLinearWin(
Origin::ZERO,
pixels,
CompressionCode::Lzma,
Expand Down
8 changes: 2 additions & 6 deletions crates/servicepoint/examples/wiping_clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;

use clap::Parser;

use servicepoint::{bitvec::prelude::BitVec, *};
use servicepoint::*;

#[derive(Parser, Debug)]
struct Cli {
Expand Down Expand Up @@ -33,12 +33,8 @@ fn main() {
enabled_pixels.set(x_offset % PIXEL_WIDTH, y, false);
}

// this works because the pixel grid has max size
let pixel_data: Vec<u8> = enabled_pixels.clone().into();
let bit_vec = BitVec::from_vec(pixel_data);

connection
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Lzma))
.send(Command::BitmapLinearWin(Origin::ZERO, enabled_pixels.clone(), CompressionCode::Lzma))
.expect("could not send command to display");
thread::sleep(sleep_duration);
}
Expand Down
Loading