pub struct BaseHandler { /* private fields */ }Expand description
Base HTTP request handler
Handles the complete request lifecycle including URL resolution, view execution, and signal emission.
Implementations§
Source§impl BaseHandler
impl BaseHandler
Sourcepub fn with_router(router: Arc<DefaultRouter>) -> Self
pub fn with_router(router: Arc<DefaultRouter>) -> Self
Create a handler with a router
§Examples
use reinhardt_dispatch::BaseHandler;
use reinhardt_urls::routers::DefaultRouter;
use std::sync::Arc;
let router = DefaultRouter::new();
let handler = BaseHandler::with_router(Arc::new(router));
assert!(handler.is_async());Sourcepub async fn handle_request(
&self,
request: Request,
) -> Result<Response, DispatchError>
pub async fn handle_request( &self, request: Request, ) -> Result<Response, DispatchError>
Handle an HTTP request
This is the main entry point for request processing. It:
- Emits
request_startedsignal - Resolves URL and dispatches to view
- Emits
request_finishedsignal
Sourcepub async fn handle_exception(
&self,
_request: &Request,
error: DispatchError,
) -> Response
pub async fn handle_exception( &self, _request: &Request, error: DispatchError, ) -> Response
Process an exception and convert it to a response.
Error details are logged server-side but not included in the response body to prevent information disclosure.
Trait Implementations§
Source§impl Default for BaseHandler
impl Default for BaseHandler
Auto Trait Implementations§
impl Freeze for BaseHandler
impl !RefUnwindSafe for BaseHandler
impl Send for BaseHandler
impl Sync for BaseHandler
impl Unpin for BaseHandler
impl UnsafeUnpin for BaseHandler
impl !UnwindSafe for BaseHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().