pub struct Config {
pub node_url: Url,
pub reconnection_timeout: Duration,
pub reconnection_delay: Duration,
}Expand description
Configuration for constructing a crate::NodeClient.
The only required field is the node URL; everything else has sensible
defaults via Config::new.
Fields§
§node_url: UrlNode WebSocket URL, e.g. ws://127.0.0.1:9944. Must use the ws://
or wss:// scheme — plain HTTP does not support subscriptions.
reconnection_timeout: DurationTotal time the client will keep retrying to reconnect before giving
up. TS default is Duration.infinity; Rust default is a very large
but finite value (~293 years) so tests can enforce a ceiling.
reconnection_delay: DurationDelay between consecutive reconnection attempts. TS default is 1s.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(node_url: Url) -> Self
pub fn new(node_url: Url) -> Self
Build a config from just a node URL, using the default reconnection
schedule (matches the TS DEFAULT_CONFIG: 1s delay, unbounded timeout).
Sourcepub fn with_reconnection_timeout(self, timeout: Duration) -> Self
pub fn with_reconnection_timeout(self, timeout: Duration) -> Self
Override the reconnection timeout.
Sourcepub fn with_reconnection_delay(self, delay: Duration) -> Self
pub fn with_reconnection_delay(self, delay: Duration) -> Self
Override the reconnection delay.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Config
impl Freeze for Config
impl Move for Config
impl RefUnwindSafe for Config
impl Send for Configwhere
RawVecInner: Send,
impl Sync for Configwhere
RawVecInner: Sync,
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Configwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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