pub struct ThrottleTimeOperator<In, InError, S>{ /* private fields */ }Expand description
§ThrottleTimeOperator
The throttle_time operator limits the frequency of downstream
emissions by emitting an upstream value, then suppressing subsequent
emissions until the duration elapses.
When the output is set to LeadingOnly, the first upstream value in a
throttle window is emitted immediately. When the output is set to
TrailingOnly, the most recent upstream value observed during the throttle
window is emitted when it ends. The default LeadingAndTrailing setting
emits both the first and the most recent values in each throttle window.
Upstream completion and cancellation can happen instantly if there is no pending trailing value, otherwise it will complete or cancel once the trailing value has been emitted.
Upstream errors are immediately propagated downstream, cancelling any pending throttled value.
§Options
Use ThrottleTimeOptions to configure duration and output behavior.
duration: The throttle window duration. Default:1s.output: Controls which emissions are produced in each throttle window. Default:ThrottleOutputBehavior::LeadingAndTrailing. Possible values:ThrottleOutputBehavior::LeadingOnly,ThrottleOutputBehavior::TrailingOnly,ThrottleOutputBehavior::LeadingAndTrailing.
Implementations§
Source§impl<In, InError, S> ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> ThrottleTimeOperator<In, InError, S>
pub fn new( duration: Duration, scheduler: SchedulerHandle<S>, ) -> ThrottleTimeOperator<In, InError, S>
pub fn new_with_options( options: ThrottleTimeOptions, scheduler: SchedulerHandle<S>, ) -> ThrottleTimeOperator<In, InError, S>
Trait Implementations§
Source§impl<In, InError, S> ComposableOperator for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> ComposableOperator for ThrottleTimeOperator<In, InError, S>
type Subscriber<Destination: 'static + Subscriber<In = <ThrottleTimeOperator<In, InError, S> as ObservableOutput>::Out, InError = <ThrottleTimeOperator<In, InError, S> as ObservableOutput>::OutError> + Send + Sync> = ThrottleTimeSubscriber<Destination, S>
fn operator_subscribe<Destination>(
&mut self,
destination: Destination,
) -> <ThrottleTimeOperator<In, InError, S> as ComposableOperator>::Subscriber<Destination>where
Destination: 'static + Subscriber<In = <ThrottleTimeOperator<In, InError, S> as ObservableOutput>::Out, InError = <ThrottleTimeOperator<In, InError, S> as ObservableOutput>::OutError> + Send + Sync,
Source§impl<In, InError, S> ObservableOutput for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> ObservableOutput for ThrottleTimeOperator<In, InError, S>
Source§impl<In, InError, S> ObserverInput for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> ObserverInput for ThrottleTimeOperator<In, InError, S>
Source§impl<In, InError, S> WithPrimaryCategory for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> WithPrimaryCategory for ThrottleTimeOperator<In, InError, S>
Auto Trait Implementations§
impl<In, InError, S> Freeze for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> RefUnwindSafe for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> Send for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> Sync for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> Unpin for ThrottleTimeOperator<In, InError, S>
impl<In, InError, S> UnwindSafe for ThrottleTimeOperator<In, InError, S>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
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>
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>
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