update fmt
This commit is contained in:
@@ -18,10 +18,12 @@ pub fn load_image_from_url(url: &str) -> Result<DynamicImage> {
|
|||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let response = reqwest::get(url).await
|
let response = reqwest::get(url)
|
||||||
|
.await
|
||||||
.map_err(|e| anyhow!(format!("Failed to fetch image from url: {}", e)))?;
|
.map_err(|e| anyhow!(format!("Failed to fetch image from url: {}", e)))?;
|
||||||
let bytes = response
|
let bytes = response
|
||||||
.bytes().await
|
.bytes()
|
||||||
|
.await
|
||||||
.map_err(|e| anyhow!(format!("Failed to get image bytes: {}", e)))?;
|
.map_err(|e| anyhow!(format!("Failed to get image bytes: {}", e)))?;
|
||||||
|
|
||||||
let cursor = Cursor::new(bytes);
|
let cursor = Cursor::new(bytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user