pub struct BatchProcessor { /* private fields */ }Expand description
Batch processor for efficient inference
Implementations§
Source§impl BatchProcessor
impl BatchProcessor
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new batch processor
Sourcepub fn add_request(
&mut self,
input: WasmTensor,
priority: Priority,
timeout_ms: Option<u32>,
) -> String
pub fn add_request( &mut self, input: WasmTensor, priority: Priority, timeout_ms: Option<u32>, ) -> String
Add a request to the batch queue
Sourcepub async fn process_batch(&mut self) -> Result<Vec<BatchResponse>, JsValue>
pub async fn process_batch(&mut self) -> Result<Vec<BatchResponse>, JsValue>
Process pending requests based on batching strategy
Sourcepub fn is_batch_ready(&self) -> bool
pub fn is_batch_ready(&self) -> bool
Check if a batch is ready to process
Sourcepub fn queue_length(&self) -> usize
pub fn queue_length(&self) -> usize
Get current queue length
Sourcepub fn clear_queue(&mut self)
pub fn clear_queue(&mut self)
Clear all pending requests
Sourcepub fn update_config(&mut self, config: BatchConfig)
pub fn update_config(&mut self, config: BatchConfig)
Update configuration
Trait Implementations§
Source§impl From<BatchProcessor> for JsValue
impl From<BatchProcessor> for JsValue
Source§fn from(value: BatchProcessor) -> Self
fn from(value: BatchProcessor) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for BatchProcessor
impl FromWasmAbi for BatchProcessor
Source§impl IntoWasmAbi for BatchProcessor
impl IntoWasmAbi for BatchProcessor
Source§impl LongRefFromWasmAbi for BatchProcessor
impl LongRefFromWasmAbi for BatchProcessor
Source§impl OptionFromWasmAbi for BatchProcessor
impl OptionFromWasmAbi for BatchProcessor
Source§impl OptionIntoWasmAbi for BatchProcessor
impl OptionIntoWasmAbi for BatchProcessor
Source§impl RefFromWasmAbi for BatchProcessor
impl RefFromWasmAbi for BatchProcessor
Source§type Anchor = RcRef<BatchProcessor>
type Anchor = RcRef<BatchProcessor>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for BatchProcessor
impl RefMutFromWasmAbi for BatchProcessor
Source§impl TryFromJsValue for BatchProcessor
impl TryFromJsValue for BatchProcessor
Source§impl VectorFromWasmAbi for BatchProcessor
impl VectorFromWasmAbi for BatchProcessor
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[BatchProcessor]>
Source§impl VectorIntoWasmAbi for BatchProcessor
impl VectorIntoWasmAbi for BatchProcessor
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[BatchProcessor]>) -> Self::Abi
Source§impl WasmDescribeVector for BatchProcessor
impl WasmDescribeVector for BatchProcessor
impl SupportsConstructor for BatchProcessor
impl SupportsInstanceProperty for BatchProcessor
impl SupportsStaticProperty for BatchProcessor
Auto Trait Implementations§
impl Freeze for BatchProcessor
impl RefUnwindSafe for BatchProcessor
impl Send for BatchProcessor
impl Sync for BatchProcessor
impl Unpin for BatchProcessor
impl UnsafeUnpin for BatchProcessor
impl UnwindSafe for BatchProcessor
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.