pub struct ConnectionLifecycle { /* private fields */ }Expand description
Owns the SDK connection lifecycle state and emits validated transitions.
Implementations§
Source§impl ConnectionLifecycle
impl ConnectionLifecycle
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a lifecycle in the ConnectionState::Connecting state.
Sourcepub const fn state(&self) -> &ConnectionState
pub const fn state(&self) -> &ConnectionState
Returns the current connection state.
Sourcepub fn observe(
&mut self,
observer: impl FnMut(&ConnectionEvent) + Send + 'static,
)
pub fn observe( &mut self, observer: impl FnMut(&ConnectionEvent) + Send + 'static, )
Registers an observer that is called after each successful transition.
Sourcepub fn connect(&mut self) -> Result<(), SdkError>
pub fn connect(&mut self) -> Result<(), SdkError>
Transitions from ConnectionState::Disconnected to connecting.
§Errors
Returns SdkError when the lifecycle is not disconnected.
Sourcepub fn reconnect_started(&mut self) -> Result<(), SdkError>
pub fn reconnect_started(&mut self) -> Result<(), SdkError>
Records that an externally authorized real reconnect attempt started.
This method has no delay, timer, retry counter, or authority producer. The
remote participant entrypoint obtains one-use attempt authority from
liminal-protocol before calling the transport.
§Errors
Returns SdkError when reconnecting from the current state is invalid.
Sourcepub fn disconnect(&mut self, reason: DisconnectReason) -> Result<(), SdkError>
pub fn disconnect(&mut self, reason: DisconnectReason) -> Result<(), SdkError>
Trait Implementations§
Source§impl Debug for ConnectionLifecycle
impl Debug for ConnectionLifecycle
Auto Trait Implementations§
impl !RefUnwindSafe for ConnectionLifecycle
impl !Sync for ConnectionLifecycle
impl !UnwindSafe for ConnectionLifecycle
impl Freeze for ConnectionLifecycle
impl Send for ConnectionLifecycle
impl Unpin for ConnectionLifecycle
impl UnsafeUnpin for ConnectionLifecycle
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