From 82779a3ed5ba2452a80a3acfd44ef51790373568 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Mon, 6 Apr 2020 08:36:52 +0100 Subject: [PATCH] fix image_to_string --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 23c4de5..08e2da4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ -use std::fmt; use std::collections::HashMap; +use std::fmt; const IMAGE_DIMENSION_SD: usize = 8; const IMAGE_DIMENSION_HD: usize = 16; @@ -190,7 +190,7 @@ fn test_image_from_string() { } fn image_to_string(image: Image) -> String { - image_to_string_opts(image, true) + image_to_string_opts(image, false) } fn image_to_string_opts(image: Image, hd: bool) -> String { @@ -199,7 +199,7 @@ fn image_to_string_opts(image: Image, hd: bool) -> String { for line in image.pixels.chunks(chunk_size) { for pixel in line { - string.push(*pixel as char); + string.push_str(&format!("{}", *pixel)); } string.push('\n'); }