Struct quinn_proto::Endpoint
source · [−]pub struct Endpoint { /* private fields */ }
Expand description
The main entry point to the library
This object performs no I/O whatsoever. Instead, it generates a stream of packets to send via
poll_transmit
, and consumes incoming packets and connection-generated events via handle
and
handle_event
.
Implementations
sourceimpl Endpoint
impl Endpoint
sourcepub fn new(
config: Arc<EndpointConfig>,
server_config: Option<Arc<ServerConfig>>
) -> Self
pub fn new(
config: Arc<EndpointConfig>,
server_config: Option<Arc<ServerConfig>>
) -> Self
Create a new endpoint
Returns Err
if the configuration is invalid.
sourcepub fn poll_transmit(&mut self) -> Option<Transmit>
pub fn poll_transmit(&mut self) -> Option<Transmit>
Get the next packet to transmit
sourcepub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
pub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
Replace the server configuration, affecting new incoming connections only
sourcepub fn handle_event(
&mut self,
ch: ConnectionHandle,
event: EndpointEvent
) -> Option<ConnectionEvent>
pub fn handle_event(
&mut self,
ch: ConnectionHandle,
event: EndpointEvent
) -> Option<ConnectionEvent>
Process EndpointEvent
s emitted from related Connection
s
In turn, processing this event may return a ConnectionEvent
for the same Connection
.
sourcepub fn handle(
&mut self,
now: Instant,
remote: SocketAddr,
local_ip: Option<IpAddr>,
ecn: Option<EcnCodepoint>,
data: BytesMut
) -> Option<(ConnectionHandle, DatagramEvent)>
pub fn handle(
&mut self,
now: Instant,
remote: SocketAddr,
local_ip: Option<IpAddr>,
ecn: Option<EcnCodepoint>,
data: BytesMut
) -> Option<(ConnectionHandle, DatagramEvent)>
Process an incoming UDP datagram
sourcepub fn connect(
&mut self,
config: ClientConfig,
remote: SocketAddr,
server_name: &str
) -> Result<(ConnectionHandle, Connection), ConnectError>
pub fn connect(
&mut self,
config: ClientConfig,
remote: SocketAddr,
server_name: &str
) -> Result<(ConnectionHandle, Connection), ConnectError>
Initiate a connection
sourcepub fn reject_new_connections(&mut self)
pub fn reject_new_connections(&mut self)
Unconditionally reject future incoming connections
sourcepub fn config(&self) -> &EndpointConfig
pub fn config(&self) -> &EndpointConfig
Access the configuration used by this endpoint
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Endpoint
impl Send for Endpoint
impl !Sync for Endpoint
impl Unpin for Endpoint
impl !UnwindSafe for Endpoint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more