Struct bolic_network::hub::peer::Hub
source · pub struct Hub<I: ID + Serialize + DeserializeOwned> { /* private fields */ }Implementations§
source§impl<I: ID + Serialize + DeserializeOwned> Hub<I>
impl<I: ID + Serialize + DeserializeOwned> Hub<I>
sourcepub fn enable_transport(
&mut self,
transport_id: Transport,
pool: Box<Pool<I>>
) -> &mut Self
pub fn enable_transport( &mut self, transport_id: Transport, pool: Box<Pool<I>> ) -> &mut Self
Enable one transport with the given pool. If transport exists, it will not be changed.
sourcepub async fn add_peer(
&mut self,
peer_id: I,
transport: Transport,
addrs: impl AsRef<[String]>
) -> Result<()>
pub async fn add_peer( &mut self, peer_id: I, transport: Transport, addrs: impl AsRef<[String]> ) -> Result<()>
Add a new peer. If peer already exists, it functions the same ways as [set_peer_addr].
sourcepub async fn remove_peer(
&mut self,
peer_id: I,
transport: Transport
) -> Result<()>
pub async fn remove_peer( &mut self, peer_id: I, transport: Transport ) -> Result<()>
Remove a peer. This will disconnect to the peer in all transports and the peer cannot
establish communication unless it is added back by add_peer.
pub fn set_peer_addr( &mut self, peer_id: I, transport: Transport, addrs: impl AsRef<[String]> ) -> Result<()>
pub async fn set_retry_delay( &mut self, peer_id: I, transport: Transport, delay: Box<dyn DelayGenerator> ) -> Result<()>
pub fn inbound(&self, peer_id: I, transport: Transport) -> Result<Receiver<'_>>
pub fn outbound(&self, peer_id: I, transport: Transport) -> Result<Sender>
pub async fn reset(&self, peer_id: I, transport: Transport) -> Result<()>
pub fn get_id(&self) -> &I
pub fn get_driver(&self) -> &Driver
Auto Trait Implementations§
impl<I> Freeze for Hub<I>where
I: Freeze,
impl<I> !RefUnwindSafe for Hub<I>
impl<I> Send for Hub<I>
impl<I> Sync for Hub<I>
impl<I> Unpin for Hub<I>where
I: Unpin,
impl<I> !UnwindSafe for Hub<I>
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