mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-19 22:08:30 +00:00
Appease Clippy 1.68 and refactor http_api (#4068)
## Proposed Changes Two tiny updates to satisfy Clippy 1.68 Plus refactoring of the `http_api` into less complex types so the compiler can chew and digest them more easily. Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
25
common/warp_utils/src/uor.rs
Normal file
25
common/warp_utils/src/uor.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use warp::{filters::BoxedFilter, Filter, Rejection};
|
||||
|
||||
/// Mixin trait for `Filter` providing the unifying-or method.
|
||||
pub trait UnifyingOrFilter: Filter<Error = Rejection> + Sized + Send + Sync + 'static
|
||||
where
|
||||
Self::Extract: Send,
|
||||
{
|
||||
/// Unifying `or`.
|
||||
///
|
||||
/// This is a shorthand for `self.or(other).unify().boxed()`, which is useful because it keeps
|
||||
/// the filter type simple and prevents type-checker explosions.
|
||||
fn uor<F>(self, other: F) -> BoxedFilter<Self::Extract>
|
||||
where
|
||||
F: Filter<Extract = Self::Extract, Error = Rejection> + Clone + Send + Sync + 'static,
|
||||
{
|
||||
self.or(other).unify().boxed()
|
||||
}
|
||||
}
|
||||
|
||||
impl<F> UnifyingOrFilter for F
|
||||
where
|
||||
F: Filter<Error = Rejection> + Sized + Send + Sync + 'static,
|
||||
F::Extract: Send,
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user