pub struct BaseUpdateProcessor { /* private fields */ }Expand description
Wraps any UpdateProcessor with a semaphore to bound concurrency.
Implementations§
Source§impl BaseUpdateProcessor
impl BaseUpdateProcessor
Sourcepub fn new(
inner: Box<dyn UpdateProcessor>,
max_concurrent_updates: usize,
) -> Result<Self, UpdateProcessorError>
pub fn new( inner: Box<dyn UpdateProcessor>, max_concurrent_updates: usize, ) -> Result<Self, UpdateProcessorError>
Creates a new BaseUpdateProcessor.
§Errors
Returns UpdateProcessorError::InvalidConcurrency if
max_concurrent_updates is zero.
Sourcepub fn max_concurrent_updates(&self) -> usize
pub fn max_concurrent_updates(&self) -> usize
The maximum number of updates that can be processed concurrently.
Sourcepub fn current_concurrent_updates(&self) -> usize
pub fn current_concurrent_updates(&self) -> usize
A snapshot of the number of updates currently being processed.
Sourcepub async fn process_update(
&self,
update: Arc<Update>,
coroutine: Pin<Box<dyn Future<Output = ()> + Send>>,
)
pub async fn process_update( &self, update: Arc<Update>, coroutine: Pin<Box<dyn Future<Output = ()> + Send>>, )
Acquires the semaphore and then delegates to UpdateProcessor::do_process_update.
Sourcepub async fn initialize(&self)
pub async fn initialize(&self)
Delegates to the inner processor’s initialize.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BaseUpdateProcessor
impl !RefUnwindSafe for BaseUpdateProcessor
impl Send for BaseUpdateProcessor
impl Sync for BaseUpdateProcessor
impl Unpin for BaseUpdateProcessor
impl UnsafeUnpin for BaseUpdateProcessor
impl !UnwindSafe for BaseUpdateProcessor
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