pub struct AsyncBatchProcessor { /* private fields */ }Expand description
Batch processor for async inference.
Collects multiple requests and processes them in batches for improved throughput.
Implementations§
Source§impl AsyncBatchProcessor
impl AsyncBatchProcessor
Sourcepub fn new(
session: AsyncSession,
max_batch_size: usize,
timeout_ms: u64,
) -> Self
pub fn new( session: AsyncSession, max_batch_size: usize, timeout_ms: u64, ) -> Self
Create a new batch processor.
§Arguments
session- The async session to use for inferencemax_batch_size- Maximum number of requests to batch togethertimeout_ms- Maximum time to wait for batch to fill (milliseconds)
§Example
let processor = AsyncBatchProcessor::new(
session,
32, // batch up to 32 requests
10, // wait max 10ms for batch to fill
);Auto Trait Implementations§
impl Freeze for AsyncBatchProcessor
impl RefUnwindSafe for AsyncBatchProcessor
impl Send for AsyncBatchProcessor
impl Sync for AsyncBatchProcessor
impl Unpin for AsyncBatchProcessor
impl UnwindSafe for AsyncBatchProcessor
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 more