Skip to content

Commit

Permalink
expose all fields of ServerFnTraitObj via methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Jan 19, 2024
1 parent fb7bd25 commit 9855bc5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server_fn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,16 @@ impl<Req, Res> ServerFnTraitObj<Req, Res> {
pub fn method(&self) -> Method {
self.method.clone()
}

/// The handler for this server function.
pub fn handler(&self, req: Req) -> impl Future<Output = Res> + Send {
(self.handler)(req)
}

/// The set of middleware that should be applied to this function.
pub fn middleware(&self) -> MiddlewareSet<Req, Res> {
(self.middleware)()
}
}

impl<Req, Res> Service<Req, Res> for ServerFnTraitObj<Req, Res>
Expand Down

0 comments on commit 9855bc5

Please sign in to comment.