pub struct Connection<T> { /* private fields */ }Expand description
Low-level connection type that handles basic channel idx bookkeeping and inbound event buffering.
Implementations§
Source§impl<T> Connection<T>
impl<T> Connection<T>
pub fn inner(&self) -> &T
Sourcepub fn inner_mut(&mut self) -> &mut T
pub fn inner_mut(&mut self) -> &mut T
Returns a mutable reference to the inner recv instance. Note that using this to recv messages can break the bookkeeping, so use caution.
pub fn into_inner(self) -> T
pub fn protocol(&self) -> Topic
pub fn initiator(&self) -> Creator
pub fn peer_data(&self) -> &PeerData
Sourcepub fn num_open_channels(&self) -> usize
pub fn num_open_channels(&self) -> usize
Returns the number of open channels in the internal channel table. This includes channels opened in response to pending events that are buffered and need to be processed.
Sourcepub fn has_pending_events(&self) -> bool
pub fn has_pending_events(&self) -> bool
Returns if there’s events that have been produced but not consumed yet.
Source§impl<T: AsyncRecvFrame> Connection<T>
impl<T: AsyncRecvFrame> Connection<T>
Source§impl<T: AsyncSendFrame> Connection<T>
impl<T: AsyncSendFrame> Connection<T>
Sourcepub async fn open_channel(
&mut self,
topic: Topic,
payload: Vec<u8>,
flags: MsgFlags,
) -> Result<u32, Error>
pub async fn open_channel( &mut self, topic: Topic, payload: Vec<u8>, flags: MsgFlags, ) -> Result<u32, Error>
Opens a channel on a topic with a channel, optionally closing our end of it immediately.
Sourcepub async fn send_message(
&mut self,
chan_id: u32,
payload: Vec<u8>,
flags: MsgFlags,
) -> Result<bool, Error>
pub async fn send_message( &mut self, chan_id: u32, payload: Vec<u8>, flags: MsgFlags, ) -> Result<bool, Error>
Sends a message on a channel that we haven’t closed ourselves yet. Returns if the channel is kept alive after this.
Auto Trait Implementations§
impl<T> Freeze for Connection<T>where
T: Freeze,
impl<T> RefUnwindSafe for Connection<T>where
T: RefUnwindSafe,
impl<T> Send for Connection<T>where
T: Send,
impl<T> Sync for Connection<T>where
T: Sync,
impl<T> Unpin for Connection<T>where
T: Unpin,
impl<T> UnwindSafe for Connection<T>where
T: UnwindSafe,
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