use crate::{handle::ConnectionHandle, service::PubSubService, PubSubFrontend};
use alloy_transport::{impl_future, TransportResult};
#[auto_impl::auto_impl(Box)]
pub trait PubSubConnect: Sized + Send + Sync + 'static {
fn is_local(&self) -> bool;
fn connect(&self) -> impl_future!(<Output = TransportResult<ConnectionHandle>>);
fn try_reconnect(&self) -> impl_future!(<Output = TransportResult<ConnectionHandle>>) {
self.connect()
}
fn into_service(self) -> impl_future!(<Output = TransportResult<PubSubFrontend>>) {
PubSubService::connect(self)
}
}