make CommandCode pub
All checks were successful
Rust / build (pull_request) Successful in 2m19s

This commit is contained in:
Vinzenz Schroeter 2025-04-12 21:23:54 +02:00
parent cecccb3f28
commit 114385868a
6 changed files with 23 additions and 13 deletions

View file

@ -36,7 +36,11 @@ pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize {
let connection = UdpConnection::open(addr).unwrap();
connection.send(ClearCommand).unwrap();
let grid = CharGrid::from_vec(5, vec!['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd']).unwrap();
let grid = CharGrid::from_vec(
5,
vec!['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd'],
)
.unwrap();
connection.send(CharGridCommand::from(grid)).unwrap();
0

View file

@ -1,7 +1,8 @@
/// The u16 command codes used for the [Command]s.
#[repr(u16)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub(crate) enum CommandCode {
#[allow(missing_docs)]
pub enum CommandCode {
Clear = 0x0002,
Cp437Data = 0x0003,
CharBrightness = 0x0005,

View file

@ -1,8 +1,8 @@
use crate::{
command_code::CommandCode, command_code::InvalidCommandCodeError,
commands::errors::TryFromPacketError, compression::into_compressed,
compression::into_decompressed, BitVecU8Msb0, CompressionCode, Header, Offset,
Packet, TryIntoPacketError, TypedCommand,
compression::into_decompressed, BitVecU8Msb0, CompressionCode, Header,
Offset, Packet, TryIntoPacketError, TypedCommand,
};
/// Binary operations for use with the [`BitVecCommand`] command.

View file

@ -1,4 +1,6 @@
use crate::{BitVecU8Msb0, DataRef, Grid, ValueGrid, PIXEL_HEIGHT, PIXEL_WIDTH};
use crate::{
BitVecU8Msb0, DataRef, Grid, ValueGrid, PIXEL_HEIGHT, PIXEL_WIDTH,
};
use ::bitvec::{order::Msb0, prelude::BitSlice, slice::IterMut};
/// A fixed-size 2D grid of booleans.
@ -302,7 +304,9 @@ pub enum LoadBitmapError {
#[cfg(test)]
mod tests {
use crate::{BitVecU8Msb0, Bitmap, DataRef, Grid, LoadBitmapError, ValueGrid};
use crate::{
BitVecU8Msb0, Bitmap, DataRef, Grid, LoadBitmapError, ValueGrid,
};
#[test]
fn fill() {

View file

@ -56,6 +56,7 @@
//! ```
pub use crate::brightness::Brightness;
pub use crate::command_code::CommandCode;
pub use crate::commands::*;
pub use crate::compression_code::CompressionCode;
pub use crate::connections::*;

View file

@ -130,13 +130,13 @@ impl Packet {
let Packet {
header:
Header {
command_code,
a,
b,
c,
d,
},
Header {
command_code,
a,
b,
c,
d,
},
payload,
} = self;