pub struct ProviderConfig {
pub retry_attempts: u32,
pub timeout: Duration,
pub rate_limit_rps: Option<u32>,
}Expand description
Configuration for creating production-ready providers.
This struct encapsulates recommended settings for CCTP operations, including retry behavior and timeouts.
§Example
use cctp_rs::ProviderConfig;
use std::time::Duration;
// Use defaults
let config = ProviderConfig::default();
// Or customize
let config = ProviderConfig::builder()
.retry_attempts(5)
.timeout(Duration::from_secs(60))
.build();Fields§
§retry_attempts: u32Number of retry attempts for failed requests
timeout: DurationRequest timeout duration
rate_limit_rps: Option<u32>Optional rate limit (requests per second)
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn builder() -> ProviderConfigBuilder
pub fn builder() -> ProviderConfigBuilder
Creates a new builder for ProviderConfig
Sourcepub fn fast_transfer() -> Self
pub fn fast_transfer() -> Self
Creates a configuration optimized for fast transfers
Uses shorter timeouts and more aggressive retry settings suitable for time-sensitive fast transfer operations.
Sourcepub fn high_reliability() -> Self
pub fn high_reliability() -> Self
Creates a configuration for high-reliability operations
Uses longer timeouts and more retry attempts for operations where reliability is more important than speed.
Sourcepub fn rate_limited(rps: u32) -> Self
pub fn rate_limited(rps: u32) -> Self
Creates a configuration for rate-limited public endpoints
Includes rate limiting to avoid hitting provider limits on public RPC endpoints.
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProviderConfig
impl Debug for ProviderConfig
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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