pub trait PubSubConnect:
Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn is_local(&self) -> bool;
fn connect(
&self,
) -> impl Send + Future<Output = TransportResult<ConnectionHandle>>;
// Provided methods
fn try_reconnect(
&self,
) -> impl Send + Future<Output = TransportResult<ConnectionHandle>> { ... }
fn into_service(
self,
) -> impl Send + Future<Output = TransportResult<PubSubFrontend>> { ... }
}
Expand description
Configuration objects that contain connection details for a backend.
Implementers should contain configuration options for the underlying transport.
Required Methods§
sourcefn connect(
&self,
) -> impl Send + Future<Output = TransportResult<ConnectionHandle>>
fn connect( &self, ) -> impl Send + Future<Output = TransportResult<ConnectionHandle>>
Spawn the backend, returning a handle to it.
This function MUST create a long-lived task containing a
ConnectionInterface
, and return the corresponding handle.
Provided Methods§
sourcefn try_reconnect(
&self,
) -> impl Send + Future<Output = TransportResult<ConnectionHandle>>
fn try_reconnect( &self, ) -> impl Send + Future<Output = TransportResult<ConnectionHandle>>
Attempt to reconnect the transport.
Override this to add custom reconnection logic to your connector. This will be used by the internal pubsub connection managers in the event the connection fails.
sourcefn into_service(
self,
) -> impl Send + Future<Output = TransportResult<PubSubFrontend>>
fn into_service( self, ) -> impl Send + Future<Output = TransportResult<PubSubFrontend>>
Convert the configuration object into a service with a running backend.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.