WIp
This commit is contained in:
parent
37a2ef9d41
commit
e0f553c0f5
3 changed files with 29 additions and 56 deletions
|
@ -145,23 +145,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub trait MapRangeEndsExt<R> {
|
||||
fn map_range<T, F>(self, f: F) -> Range<T>
|
||||
where
|
||||
Self: Sized,
|
||||
F: Fn(R) -> T;
|
||||
}
|
||||
|
||||
impl<R> MapRangeEndsExt<R> for Range<R> {
|
||||
fn map_range<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>
|
||||
|
@ -254,7 +237,7 @@ macro_rules! iife {
|
|||
};
|
||||
}
|
||||
|
||||
/// Async lImmediately invoked function expression. Good for using the ? operator
|
||||
/// Async Immediately invoked function expression. Good for using the ? operator
|
||||
/// in functions which do not return an Option or Result. Async version of above
|
||||
#[macro_export]
|
||||
macro_rules! async_iife {
|
||||
|
@ -279,10 +262,7 @@ impl<T: Ord + Clone> RangeExt<T> for Range<T> {
|
|||
}
|
||||
|
||||
fn overlaps(&self, other: &Range<T>) -> bool {
|
||||
self.contains(&other.start)
|
||||
|| self.contains(&other.end)
|
||||
|| other.contains(&self.start)
|
||||
|| other.contains(&self.end)
|
||||
self.start < other.end && other.start < self.end
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,10 +276,7 @@ impl<T: Ord + Clone> RangeExt<T> for RangeInclusive<T> {
|
|||
}
|
||||
|
||||
fn overlaps(&self, other: &Range<T>) -> bool {
|
||||
self.contains(&other.start)
|
||||
|| self.contains(&other.end)
|
||||
|| other.contains(&self.start())
|
||||
|| other.contains(&self.end())
|
||||
self.start() < &other.end && &other.start <= self.end()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue