pub struct Responder<Req, Resp>{ /* private fields */ }Expand description
A responder that processes incoming requests and sends back responses.
The responder supports both fixed and dynamic concurrency strategies.
§Type Parameters
Req: The type of the request, must beSend + Sync + 'static.Resp: The type of the response, must beSend + Sync + 'static.Fut: The future returned by the request handler.F: The type of the request handler function.
Implementations§
Source§impl<Req, Resp> Responder<Req, Resp>
impl<Req, Resp> Responder<Req, Resp>
Sourcepub async fn process_requests_with_strategy(
self,
strategy: ConcurrencyStrategy,
) -> Result<(), Error>
pub async fn process_requests_with_strategy( self, strategy: ConcurrencyStrategy, ) -> Result<(), Error>
Sourcepub async fn process_requests(self) -> Result<(), Error>
pub async fn process_requests(self) -> Result<(), Error>
Processes incoming requests with a fixed concurrency of 16.
§Returns
Ok(()): If all requests are processed successfully.Err(Error): If an error occurs during processing.
Sourcepub async fn process_requests_dynamic(
self,
initial_concurrency: usize,
max_concurrency: usize,
) -> Result<(), Error>
pub async fn process_requests_dynamic( self, initial_concurrency: usize, max_concurrency: usize, ) -> Result<(), Error>
Processes incoming requests with dynamic concurrency adjustment.
The concurrency is adjusted based on the response time of requests.
§Parameters
initial_concurrency: The initial number of concurrent requests.max_concurrency: The maximum number of concurrent requests.
§Returns
Ok(()): If all requests are processed successfully.Err(Error): If an error occurs during processing.
Auto Trait Implementations§
impl<Req, Resp> Freeze for Responder<Req, Resp>
impl<Req, Resp> !RefUnwindSafe for Responder<Req, Resp>
impl<Req, Resp> Send for Responder<Req, Resp>
impl<Req, Resp> !Sync for Responder<Req, Resp>
impl<Req, Resp> Unpin for Responder<Req, Resp>
impl<Req, Resp> !UnwindSafe for Responder<Req, Resp>
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