Introduce HttpClient trait, use it to fetch avatars in UserStore

* Add a FakeHttpClient for tests
This commit is contained in:
Max Brunsfeld
2021-09-14 13:42:44 -07:00
parent f0019e3725
commit 84d4bb6186
9 changed files with 146 additions and 54 deletions
+15 -3
View File
@@ -1,8 +1,11 @@
use crate::geometry::vector::{vec2i, Vector2I};
use image::{Bgra, ImageBuffer};
use std::sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
use std::{
fmt,
sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
},
};
pub struct ImageData {
@@ -29,3 +32,12 @@ impl ImageData {
vec2i(width as i32, height as i32)
}
}
impl fmt::Debug for ImageData {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ImageData")
.field("id", &self.id)
.field("size", &self.data.dimensions())
.finish()
}
}