Shit doesn't fucking work

This commit is contained in:
CenTdemeern1 2025-01-30 16:05:51 +01:00
parent 0e40cff968
commit f6da9ed03b

View file

@ -35,7 +35,9 @@ pub async fn parse_head(
url: &Url, url: &Url,
mut body: impl Stream<Item = Result<Vec<u8>, String>> + Unpin, mut body: impl Stream<Item = Result<Vec<u8>, String>> + Unpin,
) -> Result<Vec<Icon>, Box<dyn Error>> { ) -> Result<Vec<Icon>, Box<dyn Error>> {
let mut icons = Vec::new(); let mut icons: Vec<
futures::future::Shared<std::pin::Pin<Box<dyn std::future::Future<Output = Vec<Icon>> + Send>>>,
> = Vec::new();
let new_icons = Arc::new(Mutex::new(Vec::new())); let new_icons = Arc::new(Mutex::new(Vec::new()));
{ {
@ -52,11 +54,11 @@ pub async fn parse_head(
.get_attribute("href") .get_attribute("href")
.and_then(|href| url.join(&href).ok()) .and_then(|href| url.join(&href).ok())
{ {
new_icons.lock().unwrap().push( // new_icons.lock().unwrap().push(
async { SiteIcons::load_manifest(href).await.unwrap_or(Vec::new()) } // async { SiteIcons::load_manifest(href).await.unwrap_or(Vec::new()) }
.boxed() // .boxed()
.shared(), // .shared(),
) // )
} }
Ok(()) Ok(())
@ -83,16 +85,16 @@ pub async fn parse_head(
let sizes = link.get_attribute("sizes"); let sizes = link.get_attribute("sizes");
new_icons.lock().unwrap().push( // new_icons.lock().unwrap().push(
async { // async {
Icon::load(href, kind, sizes) // Icon::load(href, kind, sizes)
.await // .await
.map(|icon| vec![icon]) // .map(|icon| vec![icon])
.unwrap_or(Vec::new()) // .unwrap_or(Vec::new())
} // }
.boxed() // .boxed()
.shared(), // .shared(),
) // )
}; };
Ok(()) Ok(())