Skip to content

Commit

Permalink
Add a quick breakdown, in English, of the trait bounds of a Handler impl
Browse files Browse the repository at this point in the history
  • Loading branch information
TTWNO committed Mar 18, 2024
1 parent 2ec9ff1 commit 3e8392c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions odilia/src/tower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ where
self()
}

Check warning on line 38 in odilia/src/tower.rs

View check run for this annotation

Codecov / codecov/patch

odilia/src/tower.rs#L36-L38

Added lines #L36 - L38 were not covered by tests
}

impl<F, Fut, S, E> Handler<(Request,), S, E> for F
where
F: FnOnce(E) -> Fut + Clone + Send + 'static,
Expand All @@ -60,6 +61,13 @@ where
self(req, (&state).into())
}

Check warning on line 62 in odilia/src/tower.rs

View check run for this annotation

Codecov / codecov/patch

odilia/src/tower.rs#L60-L62

Added lines #L60 - L62 were not covered by tests
}
// breakdown of the various type parameters:
//
// F: is a function that takes E, T1, T2 (all of which are generic)
// T1, T2: are type which can be created infallibly from a reference to S, which is generic
// S: is some state type that implements Clone
// Fut: is a future whoes output is Result<Response, Error>, and which is sendable across threads
// statically
impl<F, Fut, S, T1, T2, E> Handler<(Request,T1,T2), S, E> for F
where
F: FnOnce(E, T1, T2) -> Fut + Clone + Send + 'static,
Expand Down

0 comments on commit 3e8392c

Please sign in to comment.