let g = self.iter.next().unwrap_or(T::zero());
let b = self.iter.next().unwrap_or(T::zero());
println!("{} {} {}", r.as_(), g.as_(), b.as_());
- //Some(Rgb([r.unwrap_or(0) as u8, g.unwrap_or(0) as u8, b.unwrap_or(0) as u8]))
Some(Rgb([r.as_(), g.as_(), b.as_()]))
}
else {
format!("Hello {name}!")
}
-#[get("/gen/{data}")]
+#[get("/gen/0/{data}")]
async fn img_gen(req: HttpRequest) -> Result<impl Responder> {
let mut cursor = Cursor::new(Vec::new());
let mut img: RgbImage = ImageBuffer::new(32, 32);
let mut pixels = img.pixels_mut();
- let data = req.uri().path().split("/").skip(2).next().unwrap();
-
- //println!("{:#?}\n{:#?}", req.uri().path().split("/").skip(2).next(), req.match_info().get("data"));
+ let data = req.uri().path().split("/").skip(3).next().unwrap();
println!("{:?}", data);
- //for sp in ToRgbIter::new(percent_decode(&RawOsString::from_string(data.into_inner()).as_raw_bytes()).into_iter().borrow_mut()) {
for sp in ToRgbIter::new(percent_decode_str(&data).into_iter().borrow_mut()) {
let mut dp = pixels.next().unwrap();
println!("{:?}", sp);