Merge branch 'main' of github.com:zed-industries/zed into vector_store

This commit is contained in:
KCaverly 2023-06-30 09:58:13 -04:00
commit 1d737e490b
204 changed files with 14020 additions and 7149 deletions

View file

@ -118,14 +118,15 @@ pub fn merge_non_null_json_value_into(source: serde_json::Value, target: &mut se
}
}
pub trait ResultExt {
pub trait ResultExt<E> {
type Ok;
fn log_err(self) -> Option<Self::Ok>;
fn warn_on_err(self) -> Option<Self::Ok>;
fn inspect_error(self, func: impl FnOnce(&E)) -> Self;
}
impl<T, E> ResultExt for Result<T, E>
impl<T, E> ResultExt<E> for Result<T, E>
where
E: std::fmt::Debug,
{
@ -152,6 +153,15 @@ where
}
}
}
/// https://doc.rust-lang.org/std/result/enum.Result.html#method.inspect_err
fn inspect_error(self, func: impl FnOnce(&E)) -> Self {
if let Err(err) = &self {
func(err);
}
self
}
}
pub trait TryFutureExt {