feat: add set_interval helper function (#1551)

This commit is contained in:
Matthias Seitz 2022-08-02 21:14:03 +02:00 committed by GitHub
parent 9bf1bcb151
commit e2754dee4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1286,11 +1286,18 @@ impl<P: JsonRpcClient> Provider<P> {
self
}
/// Sets the default polling interval for event filters and pending transactions
/// (default: 7 seconds)
pub fn set_interval<T: Into<Duration>>(&mut self, interval: T) -> &mut Self {
self.interval = Some(interval.into());
self
}
/// Sets the default polling interval for event filters and pending transactions
/// (default: 7 seconds)
#[must_use]
pub fn interval<T: Into<Duration>>(mut self, interval: T) -> Self {
self.interval = Some(interval.into());
self.set_interval(interval);
self
}