Struct de_net::connection::dispatch::DispatchHandler
source · pub(crate) struct DispatchHandler {
book: Arc<Mutex<ConnectionBook<ConnDispatchHandler>>>,
}
Fields§
§book: Arc<Mutex<ConnectionBook<ConnDispatchHandler>>>
Implementations§
source§impl DispatchHandler
impl DispatchHandler
pub(crate) fn new() -> Self
sourcepub(crate) async fn next_package_id(
&mut self,
time: Instant,
addr: SocketAddr
) -> PackageId
pub(crate) async fn next_package_id( &mut self, time: Instant, addr: SocketAddr ) -> PackageId
Returns ID to be given to a to-be-send package.
It is assumed that this is called exactly once before each reliably send package and that all generated IDs are used.
sourcepub(crate) async fn sent(
&mut self,
time: Instant,
addr: SocketAddr,
header: PackageHeader,
data: &[u8]
)
pub(crate) async fn sent( &mut self, time: Instant, addr: SocketAddr, header: PackageHeader, data: &[u8] )
§Panics
-
If the package is already registered as sent.
-
If the data are longer than
MAX_PACKAGE_SIZE
.
sourcepub(crate) async fn confirmed(
&mut self,
time: Instant,
addr: SocketAddr,
data: &[u8]
)
pub(crate) async fn confirmed( &mut self, time: Instant, addr: SocketAddr, data: &[u8] )
Processes data with package confirmations.
The data encode IDs of delivered (and confirmed) packages so that they can be forgotten.
sourcepub(crate) async fn resend(
&mut self,
time: Instant,
buf: &mut [u8],
datagrams: &mut Sender<OutDatagram>
) -> Result<ResendResult, SendError<OutDatagram>>
pub(crate) async fn resend( &mut self, time: Instant, buf: &mut [u8], datagrams: &mut Sender<OutDatagram> ) -> Result<ResendResult, SendError<OutDatagram>>
Re-send all packages already due for re-sending.
pub(crate) async fn clean(&mut self, time: Instant)
Trait Implementations§
source§impl Clone for DispatchHandler
impl Clone for DispatchHandler
source§fn clone(&self) -> DispatchHandler
fn clone(&self) -> DispatchHandler
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for DispatchHandler
impl !RefUnwindSafe for DispatchHandler
impl Send for DispatchHandler
impl Sync for DispatchHandler
impl Unpin for DispatchHandler
impl !UnwindSafe for DispatchHandler
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