Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Relax AssetLogger trait bounds (#29450)
tidelyfde1cc78a14c
diff --git a/crates/gpui/src/asset_cache.rs b/crates/gpui/src/asset_cache.rsindex 3c6dbd99da8..9afbba8a0ed 100644--- a/crates/gpui/src/asset_cache.rs+++ b/crates/gpui/src/asset_cache.rs@@ -1,5 +1,5 @@use crate::{App, SharedString, SharedUri};-use futures::Future;+use futures::{Future, TryFutureExt};use std::fmt::Debug;use std::hash::{Hash, Hasher};@@ -51,14 +51,17 @@ pub trait Asset: 'static {) -> impl Future<Output = Self::Output> + Send + 'static;}-/// An asset Loader that logs whatever passes through it+/// An asset Loader which logs the [`Err`] variant of a [`Result`] during loadingpub enum AssetLogger<T> {#[doc(hidden)]_Phantom(PhantomData<T>, &'static dyn crate::seal::Sealed),}-impl<R: Clone + Send, E: Clone + Send + std::error::Error, T: Asset<Output = Result<R, E>>> Asset- for AssetLogger<T>+impl<T, R, E> Asset for AssetLogger<T>+where+ T: Asset<Output = Result<R, E>>,+ R: Clone + Send,+ E: Clone + Send + std::fmt::Display,{type Source = T::Source;@@ -69,10 +72,7 @@ impl<R: Clone + Send, E: Clone + Send + std::error::Error, T: Asset<Output = Rescx: &mut App,) -> impl Future<Output = Self::Output> + Send + 'static {let load = T::load(source, cx);- async {- load.await- .inspect_err(|e| log::error!("Failed to load asset: {}", e))- }+ load.inspect_err(|e| log::error!("Failed to load asset: {}", e))}}