pub struct Endpoint<S, Q> { /* private fields */ }Expand description
The main entry point to the library
This object performs no I/O whatsoever. Instead, it consumes incoming packets and
connection-generated events via handle and handle_event.
Implementations§
Source§impl<S, Q> Endpoint<S, Q>
impl<S, Q> Endpoint<S, Q>
Sourcepub fn with_capacity(capacity: usize) -> Result<Self, S::Error>
pub fn with_capacity(capacity: usize) -> Result<Self, S::Error>
Create a new server endpoint with a specific capacity
Sourcepub fn accept(&mut self) -> Result<ConnectionHandle, Error<S::Error, Q::Error>>
pub fn accept(&mut self) -> Result<ConnectionHandle, Error<S::Error, Q::Error>>
Accept a new connection
Sourcepub fn recv<'container, 'innards>(
&mut self,
ch: ConnectionHandle,
msg: Message<'container, 'innards>,
) -> Result<Query<'container, 'innards>, Error<S::Error, Q::Error>>
pub fn recv<'container, 'innards>( &mut self, ch: ConnectionHandle, msg: Message<'container, 'innards>, ) -> Result<Query<'container, 'innards>, Error<S::Error, Q::Error>>
Handle an incoming query message
Sourcepub fn response(
&mut self,
qh: QueryHandle,
question: Question<'_>,
) -> Result<Outgoing, Error<S::Error, Q::Error>>
pub fn response( &mut self, qh: QueryHandle, question: Question<'_>, ) -> Result<Outgoing, Error<S::Error, Q::Error>>
Generate a response for a question
Sourcepub fn drain_query(
&mut self,
qh: QueryHandle,
) -> Result<(), Error<S::Error, Q::Error>>
pub fn drain_query( &mut self, qh: QueryHandle, ) -> Result<(), Error<S::Error, Q::Error>>
Handle a query drain event
Sourcepub fn drain_connection(
&mut self,
ch: ConnectionHandle,
) -> Result<Closed<Q>, Error<S::Error, Q::Error>>
pub fn drain_connection( &mut self, ch: ConnectionHandle, ) -> Result<Closed<Q>, Error<S::Error, Q::Error>>
Handle a connection drain event
Trait Implementations§
Auto Trait Implementations§
impl<S, Q> Freeze for Endpoint<S, Q>where
S: Freeze,
impl<S, Q> RefUnwindSafe for Endpoint<S, Q>where
S: RefUnwindSafe,
Q: RefUnwindSafe,
impl<S, Q> Send for Endpoint<S, Q>
impl<S, Q> Sync for Endpoint<S, Q>
impl<S, Q> Unpin for Endpoint<S, Q>
impl<S, Q> UnwindSafe for Endpoint<S, Q>where
S: UnwindSafe,
Q: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more