Skip to content

Commit

Permalink
Remove return type generic on HandlerService
Browse files Browse the repository at this point in the history
  • Loading branch information
TTWNO committed Jun 18, 2024
1 parent 2dc1257 commit 9ce4a00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions odilia/src/tower/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tower::Service;
pub trait Handler<T> {
type Response;
type Future: Future<Output = Self::Response>;
fn into_service<R>(self) -> HandlerService<Self, T, R>
fn into_service(self) -> HandlerService<Self, T>
where
Self: Sized,
{
Expand Down Expand Up @@ -47,19 +47,19 @@ impl_handler!(T1, T2, T3, T4, T5, T6,);
impl_handler!(T1, T2, T3, T4, T5, T6, T7,);

#[allow(clippy::type_complexity)]
pub struct HandlerService<H, T, R> {
pub struct HandlerService<H, T> {
handler: H,
_marker: PhantomData<fn(T) -> R>,
_marker: PhantomData<fn(T)>,
}
impl<H, T, R> Clone for HandlerService<H, T, R>
impl<H, T> Clone for HandlerService<H, T>
where
H: Clone,
{
fn clone(&self) -> Self {
HandlerService { handler: self.handler.clone(), _marker: PhantomData }
}
}
impl<H, T, R> HandlerService<H, T, R> {
impl<H, T> HandlerService<H, T> {
fn new(handler: H) -> Self
where
H: Handler<T>,
Expand All @@ -68,7 +68,7 @@ impl<H, T, R> HandlerService<H, T, R> {
}
}

impl<H, T, R> Service<T> for HandlerService<H, T, R>
impl<H, T> Service<T> for HandlerService<H, T>
where
H: Handler<T> + Clone,
{
Expand Down
4 changes: 2 additions & 2 deletions odilia/src/tower/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Handlers {
<T as TryFromState<Arc<ScreenReaderState>, C>>::Error: Send,
{
let try_cmd_service = handler
.into_service::<R>()
.into_service()
.unwrap_map(|r| r.into())
.request_async_try_from()
.with_state(Arc::clone(&self.state))
Expand Down Expand Up @@ -146,7 +146,7 @@ impl Handlers {
<T as TryFromState<Arc<ScreenReaderState>, E>>::Future: Send,
{
let serv = handler
.into_service::<R>()
.into_service()
.unwrap_map(|res| res.try_into_commands())
.request_async_try_from()
.with_state(Arc::clone(&self.state))
Expand Down

0 comments on commit 9ce4a00

Please sign in to comment.