pub struct Peer {
pub connections: RwLock<HashMap<ConnectionId, ConnectionState>>,
/* private fields */
}
Fields§
§connections: RwLock<HashMap<ConnectionId, ConnectionState>>
Implementations§
source§impl Peer
impl Peer
pub fn new(epoch: u32) -> Arc<Self>
pub fn epoch(&self) -> u32
pub fn add_connection<F, Fut, Out>( self: &Arc<Self>, connection: Connection, create_timer: F ) -> (ConnectionId, impl Future<Output = Result<()>> + Send, BoxStream<'static, Box<dyn AnyTypedEnvelope>>)where F: Send + Fn(Duration) -> Fut, Fut: Send + Future<Output = Out>, Out: Send,
pub fn disconnect(&self, connection_id: ConnectionId)
pub fn reset(&self, epoch: u32)
pub fn teardown(&self)
pub fn request<T: RequestMessage>( &self, receiver_id: ConnectionId, request: T ) -> impl Future<Output = Result<T::Response>>
pub fn request_envelope<T: RequestMessage>( &self, receiver_id: ConnectionId, request: T ) -> impl Future<Output = Result<TypedEnvelope<T::Response>>>
pub fn forward_request<T: RequestMessage>( &self, sender_id: ConnectionId, receiver_id: ConnectionId, request: T ) -> impl Future<Output = Result<T::Response>>
pub fn request_internal<T: RequestMessage>( &self, original_sender_id: Option<ConnectionId>, receiver_id: ConnectionId, request: T ) -> impl Future<Output = Result<TypedEnvelope<T::Response>>>
pub fn send<T: EnvelopedMessage>( &self, receiver_id: ConnectionId, message: T ) -> Result<()>
pub fn forward_send<T: EnvelopedMessage>( &self, sender_id: ConnectionId, receiver_id: ConnectionId, message: T ) -> Result<()>
pub fn respond<T: RequestMessage>( &self, receipt: Receipt<T>, response: T::Response ) -> Result<()>
pub fn respond_with_error<T: RequestMessage>( &self, receipt: Receipt<T>, response: Error ) -> Result<()>
pub fn respond_with_unhandled_message( &self, envelope: Box<dyn AnyTypedEnvelope> ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Peer
impl Send for Peer
impl Sync for Peer
impl Unpin for Peer
impl !UnwindSafe for Peer
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