pub fn service(&mut self, timeout: Duration) -> Result<Option<Event>, Error> {
        // ENetEvent is Copy (aka has no Drop impl), so we don't have to make sure we `mem::forget` it later on
        let mut sys_event = MaybeUninit::uninit();

        let res = unsafe {
            enet_host_service(
                self.inner,
                sys_event.as_mut_ptr(),
                timeout.as_millis() as u32,
            )
        };

        match res {
            r if r > 0 => Ok(unsafe { self.process_event(sys_event.assume_init()) }),
            0 => Ok(None),
            r if r < 0 => Err(Error(r)),
            _ => panic!("unreachable"),
        }

        // TODO: check `total*` fields on `inner`, these need to be reset from time to time.
    }
/// Maintains this host and delivers an event if available.
///
/// This should be called regularly for ENet to work properly with good performance.
///
/// The function won't block for less than 1ms.
Maintains this host and delivers an event if available.
This should be called regularly for ENet to work properly with good performance.

The function won't block for less than 1ms.
Maintains this host and delivers an event if available . This should be called regularly for ENet to work properly with good performance . The function won ' t block for less than 1ms .
pub fn service(&mut self, timeout: Duration) -> Result<Option<Event>, Error> {
        // ENetEvent is Copy (aka has no Drop impl), so we don't have to make sure we `mem::forget` it later on
        let mut sys_event = MaybeUninit::uninit();
        let res = unsafe {
            enet_host_service(
                self.inner,
                sys_event.as_mut_ptr(),
                timeout.as_millis() as u32,
            )
        };
        match res {
            r if r > 0 => Ok(unsafe { self.process_event(sys_event.assume_init()) }),
            0 => Ok(None),
            r if r < 0 => Err(Error(r)),
            _ => panic!("unreachable"),
        }
        // TODO: check `total*` fields on `inner`, these need to be reset from time to time.
    }
pub fn service ( & mut self , timeout : Duration ) -> Result < Option < Event > , Error > { // ENetEvent is Copy (aka has no Drop impl), so we don't have to make sure we `mem::forget` it later on let mut sys_event = MaybeUninit :: uninit ( ) ; let res = unsafe { enet_host_service ( self . inner , sys_event . as_mut_ptr ( ) , timeout . as_millis ( ) as u32 , ) } ; match res { r if r > 0 => Ok ( unsafe { self . process_event ( sys_event . assume_init ( ) ) } ) , 0 => Ok ( None ) , r if r < 0 => Err ( Error ( r ) ) , _ => panic ! ( " " ) , } // TODO: check `total*` fields on `inner`, these need to be reset from time to time. }
Maintains this host and delivers an event if available.
Maintains this host and delivers an event if available .
&mut self
timeout
Duration
&mut self
timeout
Duration