pub struct ConnectionManager { /* private fields */ }Expand description
Connection manager for Interactive Brokers clients.
Handles automatic reconnection with exponential backoff, connection monitoring, and subscription resubscription on reconnect.
Implementations§
Source§impl ConnectionManager
impl ConnectionManager
Sourcepub fn new(host: String, port: u16, client_id: i32, max_attempts: u32) -> Self
pub fn new(host: String, port: u16, client_id: i32, max_attempts: u32) -> Self
Create a new connection manager.
§Arguments
host- Host addressport- Port numberclient_id- Client IDmax_attempts- Maximum connection attempts (0 = infinite)
Sourcepub async fn connect_with_retry(&self) -> Result<Arc<Client>>
pub async fn connect_with_retry(&self) -> Result<Arc<Client>>
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if currently connected.
Sourcepub fn mark_disconnected(&self)
pub fn mark_disconnected(&self)
Sourcepub fn attempt_count(&self) -> u32
pub fn attempt_count(&self) -> u32
Get current attempt count.
Sourcepub fn current_backoff(&self) -> Duration
pub fn current_backoff(&self) -> Duration
Sourcepub fn time_since_disconnection(&self) -> Option<Duration>
pub fn time_since_disconnection(&self) -> Option<Duration>
Trait Implementations§
Source§impl Clone for ConnectionManager
impl Clone for ConnectionManager
Source§fn clone(&self) -> ConnectionManager
fn clone(&self) -> ConnectionManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConnectionManager
impl RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl UnsafeUnpin for ConnectionManager
impl UnwindSafe for ConnectionManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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