Fix bugs in code folding

This commit is contained in:
Mikayla Maki 2023-02-26 11:25:58 -08:00
parent e3061066c9
commit 637e8ada42
7 changed files with 82 additions and 27 deletions

View file

@ -145,6 +145,23 @@ where
}
}
pub trait MapRangeEndsExt<R> {
fn map_endpoints<T, F>(self, f: F) -> Range<T>
where
Self: Sized,
F: Fn(R) -> T;
}
impl<R> MapRangeEndsExt<R> for Range<R> {
fn map_endpoints<T, F>(self, f: F) -> Range<T>
where
Self: Sized,
F: Fn(R) -> T,
{
f(self.start)..f(self.end)
}
}
pub struct LogErrorFuture<F>(F, log::Level);
impl<F, T> Future for LogErrorFuture<F>