fix check errors
This commit is contained in:
parent
dd5ccf5502
commit
ff458116b7
5 changed files with 11 additions and 11 deletions
|
|
@ -12,9 +12,9 @@ pub enum Color {
|
||||||
impl Display for Color {
|
impl Display for Color {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Color::RGB24(r, g, b) => write!(f, "#{:02X}{:02X}{:02X}FF", r, g, b),
|
Color::RGB24(r, g, b) => write!(f, "#{r:02X}{g:02X}{b:02X}FF"),
|
||||||
Color::RGBA32(r, g, b, a) => write!(f, "#{:02X}{:02X}{:02X}{:02X}", r, g, b, a),
|
Color::RGBA32(r, g, b, a) => write!(f, "#{r:02X}{g:02X}{b:02X}{a:02X}"),
|
||||||
Color::W8(w) => write!(f, "#{:02X}{:02X}{:02X}FF", w, w, w),
|
Color::W8(w) => write!(f, "#{w:02X}{w:02X}{w:02X}FF"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,19 +60,19 @@ impl<T> Flut<T> {
|
||||||
impl<T> Grid<Coordinate, T> for Flut<T> {
|
impl<T> Grid<Coordinate, T> for Flut<T> {
|
||||||
fn get(&self, x: Coordinate, y: Coordinate) -> Option<&T> {
|
fn get(&self, x: Coordinate, y: Coordinate) -> Option<&T> {
|
||||||
self.index(x, y)
|
self.index(x, y)
|
||||||
.map(|idx| unsafe { &(*self.cells.get())[idx] })
|
.map(|idx| unsafe { &(&(*self.cells.get()))[idx] })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set(&self, x: Coordinate, y: Coordinate, value: T) {
|
fn set(&self, x: Coordinate, y: Coordinate, value: T) {
|
||||||
match self.index(x, y) {
|
match self.index(x, y) {
|
||||||
None => (),
|
None => (),
|
||||||
Some(idx) => unsafe { (*self.cells.get())[idx] = value },
|
Some(idx) => unsafe { (&mut (*self.cells.get()))[idx] = value },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_unchecked(&self, x: Coordinate, y: Coordinate) -> &T {
|
fn get_unchecked(&self, x: Coordinate, y: Coordinate) -> &T {
|
||||||
let idx = y as usize * self.size_x + x as usize;
|
let idx = y as usize * self.size_x + x as usize;
|
||||||
unsafe { &(*self.cells.get())[idx] }
|
unsafe { &(&(*self.cells.get()))[idx] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,12 +113,12 @@ To set a pixel using RGB, use ({SET_PX_RGB_BIN:02X}) (u8 canvas) (x as u16_le) (
|
||||||
match protocol {
|
match protocol {
|
||||||
crate::ProtocolStatus::Enabled(proto) => {
|
crate::ProtocolStatus::Enabled(proto) => {
|
||||||
writer
|
writer
|
||||||
.write_all(format!("Enabled: {}\n", proto).as_bytes())
|
.write_all(format!("Enabled: {proto}\n").as_bytes())
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
crate::ProtocolStatus::Disabled(proto) => {
|
crate::ProtocolStatus::Disabled(proto) => {
|
||||||
writer
|
writer
|
||||||
.write_all(format!("Disabled: {}\n", proto).as_bytes())
|
.write_all(format!("Disabled: {proto}\n").as_bytes())
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,12 +153,12 @@ impl<W: AsyncWriteExt + std::marker::Unpin> Responder<W> for TextParser {
|
||||||
match protocol {
|
match protocol {
|
||||||
crate::ProtocolStatus::Enabled(proto) => {
|
crate::ProtocolStatus::Enabled(proto) => {
|
||||||
writer
|
writer
|
||||||
.write_all(format!("Enabled: {}\n", proto).as_bytes())
|
.write_all(format!("Enabled: {proto}\n").as_bytes())
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
crate::ProtocolStatus::Disabled(proto) => {
|
crate::ProtocolStatus::Disabled(proto) => {
|
||||||
writer
|
writer
|
||||||
.write_all(format!("Disabled: {}\n", proto).as_bytes())
|
.write_all(format!("Disabled: {proto}\n").as_bytes())
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ fn make_image_stream(
|
||||||
fn make_stats() -> Message {
|
fn make_stats() -> Message {
|
||||||
let pixels: u64 = COUNTER.load(std::sync::atomic::Ordering::Relaxed);
|
let pixels: u64 = COUNTER.load(std::sync::atomic::Ordering::Relaxed);
|
||||||
let clients: u64 = CLIENTS.load(std::sync::atomic::Ordering::Relaxed);
|
let clients: u64 = CLIENTS.load(std::sync::atomic::Ordering::Relaxed);
|
||||||
format!("{{\"c\":{}, \"p\":{}}}", clients, pixels).into()
|
format!("{{\"c\":{clients}, \"p\":{pixels}}}").into()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn stats_stream(ws: WebSocketUpgrade) -> Response {
|
async fn stats_stream(ws: WebSocketUpgrade) -> Response {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue