Skip to content

Commit

Permalink
Rename some variables to be more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusCDE committed Dec 4, 2023
1 parent 87d1887 commit f2c78a0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ fn main() {
&rgb565,
)
.unwrap();
let url = request.url().to_lowercase();
let (data, mime) = if url.ends_with("jpg") || url.ends_with("jpeg") {
let url_lc = request.url().to_lowercase();
let (data, mime) = if url_lc.ends_with("jpg") || url_lc.ends_with("jpeg") {
(encode(&*&rgb888, ImageFormat::Jpeg), "image/jpeg")
} else if url.ends_with("gif") {
} else if url_lc.ends_with("gif") {
(encode(&*&rgb888, ImageFormat::Gif), "image/gif")
} else if url.ends_with("bmp") {
} else if url_lc.ends_with("bmp") {
(encode(&*&rgb888, ImageFormat::Bmp), "image/bmp")
} else if url.ends_with("tga") {
} else if url_lc.ends_with("tga") {
(encode(&*&rgb888, ImageFormat::Tga), "image/x-tga")
} else {
(encode(&*&rgb888, ImageFormat::Png), "image/png")
Expand All @@ -78,14 +78,14 @@ fn encode(img_buf: &[u8], format: ImageFormat) -> Vec<u8> {
_ => unimplemented!(),
}
.unwrap();
let res = writer.into_inner();
let encoded = writer.into_inner();
println!(
"Encoded screenshot as {:?} in {:?} resulting in a file of {} KiB",
format,
start.elapsed(),
res.len() / 1024
encoded.len() / 1024
);
res
encoded
}

const INDEX_PAGE: &str = r#"<!DOCTYPE html>
Expand Down

0 comments on commit f2c78a0

Please sign in to comment.