pub fn on_change<TToken, TProducer, TConsumer, TState>(
producer: TProducer,
consumer: TConsumer,
state: Option<Arc<TState>>
) -> impl Subscription
Expand description
Registers a consumer action to be invoked whenever the token produced changes.
Arguments
producer
- The function that produces the change tokenconsumer
- The function that is called when the change token changesstate
- The optional state supplied to the consumer
Returns
An opaque subscription. When it is dropped, the producer will no longer be polled and the consumer will no longer be notified.