update fmt

This commit is contained in:
jhqxxx
2026-03-06 17:28:08 +08:00
parent 8ada86714c
commit 2d37efaab6
+4 -2
View File
@@ -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);