cargo fmt

This commit is contained in:
Vinzenz Schroeter 2024-05-12 13:14:33 +02:00
parent 62ca9037b6
commit 0b28b24900
7 changed files with 15 additions and 14 deletions

View file

@ -91,7 +91,9 @@ impl Into<Vec<u8>> for BitVec {
impl From<&[u8]> for BitVec { impl From<&[u8]> for BitVec {
fn from(value: &[u8]) -> Self { fn from(value: &[u8]) -> Self {
Self { data: Vec::from(value) } Self {
data: Vec::from(value),
}
} }
} }

View file

@ -1,5 +1,8 @@
use crate::{BitVec, ByteGrid, CommandCode, CompressionCode, Header, Packet, PixelGrid, TILE_SIZE};
use crate::compression::{into_compressed, into_decompressed}; use crate::compression::{into_compressed, into_decompressed};
use crate::{
BitVec, ByteGrid, CommandCode, CompressionCode, Header, Packet, PixelGrid,
TILE_SIZE,
};
/// An origin marks the top left position of a window sent to the display. /// An origin marks the top left position of a window sent to the display.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
@ -266,10 +269,7 @@ fn origin_size_payload(
} }
fn command_code_only(code: CommandCode) -> Packet { fn command_code_only(code: CommandCode) -> Packet {
Packet( Packet(Header(code.into(), 0x0000, 0x0000, 0x0000, 0x0000), vec![])
Header(code.into(), 0x0000, 0x0000, 0x0000, 0x0000),
vec![],
)
} }
fn check_empty_header(header: Header) -> Option<TryFromPacketError> { fn check_empty_header(header: Header) -> Option<TryFromPacketError> {

View file

@ -43,7 +43,7 @@ impl TryFrom<u16> for CommandCode {
value if value == BitmapLinearAnd as u16 => Ok(BitmapLinearAnd), value if value == BitmapLinearAnd as u16 => Ok(BitmapLinearAnd),
value if value == BitmapLinearOr as u16 => Ok(BitmapLinearOr), value if value == BitmapLinearOr as u16 => Ok(BitmapLinearOr),
value if value == BitmapLinearXor as u16 => Ok(BitmapLinearXor), value if value == BitmapLinearXor as u16 => Ok(BitmapLinearXor),
_ => Err(()) _ => Err(()),
} }
} }
} }

View file

@ -1,11 +1,11 @@
#[cfg(feature = "compression")]
use std::io::{Read, Write};
#[cfg(feature = "compression-bz")] #[cfg(feature = "compression-bz")]
use bzip2::read::{BzDecoder, BzEncoder}; use bzip2::read::{BzDecoder, BzEncoder};
#[cfg(feature = "compression-gz")] #[cfg(feature = "compression-gz")]
use flate2::read::{GzDecoder, GzEncoder}; use flate2::read::{GzDecoder, GzEncoder};
#[cfg(feature = "compression-lz")] #[cfg(feature = "compression-lz")]
use lz4::{Decoder as Lz4Decoder, EncoderBuilder as Lz4EncoderBuilder}; use lz4::{Decoder as Lz4Decoder, EncoderBuilder as Lz4EncoderBuilder};
#[cfg(feature = "compression")]
use std::io::{Read, Write};
#[cfg(feature = "compression-zs")] #[cfg(feature = "compression-zs")]
use zstd::{Decoder as ZstdDecoder, Encoder as ZstdEncoder}; use zstd::{Decoder as ZstdDecoder, Encoder as ZstdEncoder};

View file

@ -35,7 +35,7 @@ impl TryFrom<u16> for CompressionCode {
value if value == Lz as u16 => Ok(Lz), value if value == Lz as u16 => Ok(Lz),
#[cfg(feature = "compression-zs")] #[cfg(feature = "compression-zs")]
value if value == Zs as u16 => Ok(Zs), value if value == Zs as u16 => Ok(Zs),
_ => Err(()) _ => Err(()),
} }
} }
} }

View file

@ -1,21 +1,21 @@
pub use crate::bit_vec::BitVec; pub use crate::bit_vec::BitVec;
pub use crate::byte_grid::ByteGrid; pub use crate::byte_grid::ByteGrid;
pub use crate::command::{Command, Origin, Size}; pub use crate::command::{Command, Origin, Size};
pub use crate::command_code::CommandCode;
pub use crate::compression_code::CompressionCode;
pub use crate::connection::Connection; pub use crate::connection::Connection;
pub use crate::packet::{Header, Packet, Payload}; pub use crate::packet::{Header, Packet, Payload};
pub use crate::pixel_grid::PixelGrid; pub use crate::pixel_grid::PixelGrid;
pub use crate::command_code::CommandCode;
pub use crate::compression_code::CompressionCode;
mod bit_vec; mod bit_vec;
mod byte_grid; mod byte_grid;
mod command; mod command;
mod command_code; mod command_code;
mod compression; mod compression;
mod compression_code;
mod connection; mod connection;
mod packet; mod packet;
mod pixel_grid; mod pixel_grid;
mod compression_code;
/// size of a single tile in one dimension /// size of a single tile in one dimension
pub const TILE_SIZE: u16 = 8; pub const TILE_SIZE: u16 = 8;

View file

@ -11,7 +11,6 @@ pub struct PixelGrid {
} }
impl PixelGrid { impl PixelGrid {
/// Creates a new pixel grid with the specified dimensions. /// Creates a new pixel grid with the specified dimensions.
/// ///
/// # Arguments /// # Arguments