[−][src]Struct harlequinn::HqEndpoint
A harlequinn client or server endpoint.
Methods
impl HqEndpoint
[src]
pub fn new_client(protocol: &str) -> Self
[src]
Creates a new client endpoint.
Doesn't listen for incoming connections, use connect
to start a connection to a server.
pub fn new_server(
protocol: &str,
socket_addr: SocketAddr,
certificate: Certificate,
private_key: PrivateKey
) -> Self
[src]
protocol: &str,
socket_addr: SocketAddr,
certificate: Certificate,
private_key: PrivateKey
) -> Self
Creates a new server endpoint.
Listens for incoming connections.
pub fn connect<S: ToString>(
&mut self,
server_addr: SocketAddr,
server_name: S,
certificate: Certificate
) -> PeerId
[src]
&mut self,
server_addr: SocketAddr,
server_name: S,
certificate: Certificate
) -> PeerId
Initiate a connection to a server endpoint.
Raises ConnectionFailed
on failure, and ConnectionRequested
on success.
pub fn disconnect(&mut self, peer_id: PeerId, reason: String)
[src]
Disconnects a peer, ending the connection.
reason
is not preserved intact, and will be mangled on the other side, but can be used to
provide human-readable reasons.
pub fn accept(&mut self, peer_id: PeerId)
[src]
Accepts a pending connection.
pub fn reject(&mut self, peer_id: PeerId)
[src]
Rejects a pending connection.
pub fn send_datagram(&mut self, peer_id: PeerId, bytes: Bytes)
[src]
Send an unreliable datagram to a peer.
If the peer is taking too long to respond to messages, this may disconnect the peer.
pub fn send_message(
&mut self,
peer_id: PeerId,
bytes: Bytes,
order: MessageOrder
)
[src]
&mut self,
peer_id: PeerId,
bytes: Bytes,
order: MessageOrder
)
Send a reliable message over the main stream to a peer.
Messages with ordered
set to true will arrive in order at the peer.
If the peer is taking too long to respond to messages, this may disconnect the peer.
pub fn poll_events(&mut self, events: &mut Vec<EndpointEvent>)
[src]
Polls for events and stores them in the given events buffer.
This must be called frequently, or the endpoint will run out of space in the events channel and stall.
Trait Implementations
impl Drop for HqEndpoint
[src]
Auto Trait Implementations
impl Send for HqEndpoint
impl Sync for HqEndpoint
impl Unpin for HqEndpoint
impl !UnwindSafe for HqEndpoint
impl !RefUnwindSafe for HqEndpoint
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,