Handler

Trait Handler 

Source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle(
        &self,
        request: Request,
    ) -> impl Future<Output = Result<Response, Box<dyn Error + Send + Sync>>> + Send;
}
Expand description

A trait for processing incoming RADIUS requests and producing responses.

Handler is the primary entry point for your application logic. It receives a Request, which contains the decrypted RADIUS packet and client metadata, and must return a [HandlerResult] containing the Response.

Since the trait is Send + Sync + 'static, it is safe to share across multiple threads and asynchronous tasks.

Required Methods§

Source

fn handle( &self, request: Request, ) -> impl Future<Output = Result<Response, Box<dyn Error + Send + Sync>>> + Send

Processes a RADIUS request asynchronously.

§Parameters
  • request: The incoming RADIUS request and client information.
§Returns

A future that resolves to a HandlerResult<Response>.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F, Fut> Handler for HandlerFn<F>
where F: Fn(Request) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Response, Box<dyn Error + Send + Sync>>> + Send + 'static,