pub struct IoContext<Message>{ /* private fields */ }
Expand description
IO access point. This is passed to all IO handlers and provides an interface to the IO subsystem.
Implementations§
source§impl<Message> IoContext<Message>
impl<Message> IoContext<Message>
sourcepub fn new(channel: IoChannel<Message>, handler: usize) -> IoContext<Message>
pub fn new(channel: IoChannel<Message>, handler: usize) -> IoContext<Message>
Create a new IO access point. Takes references to all the data that can be updated within the IO handler.
sourcepub fn register_timer(
&self,
token: TimerToken,
delay: Duration
) -> Result<(), IoError>
pub fn register_timer( &self, token: TimerToken, delay: Duration ) -> Result<(), IoError>
Register a new recurring IO timer. ‘IoHandler::timeout’ will be called with the token.
sourcepub fn register_timer_once(
&self,
token: TimerToken,
delay: Duration
) -> Result<(), IoError>
pub fn register_timer_once( &self, token: TimerToken, delay: Duration ) -> Result<(), IoError>
Register a new IO timer once. ‘IoHandler::timeout’ will be called with the token.
sourcepub fn register_timer_once_nocancel(
&self,
token: TimerToken,
delay: Duration
) -> Result<(), IoError>
pub fn register_timer_once_nocancel( &self, token: TimerToken, delay: Duration ) -> Result<(), IoError>
Register a new IO timer once. ‘IoHandler::timeout’ will be called with the token. Do NOT cancel other timer on the same token after timeout.
sourcepub fn clear_timer(&self, token: TimerToken) -> Result<(), IoError>
pub fn clear_timer(&self, token: TimerToken) -> Result<(), IoError>
Delete a timer.
sourcepub fn register_stream(&self, token: StreamToken) -> Result<(), IoError>
pub fn register_stream(&self, token: StreamToken) -> Result<(), IoError>
Register a new IO stream.
sourcepub fn deregister_stream(&self, token: StreamToken) -> Result<(), IoError>
pub fn deregister_stream(&self, token: StreamToken) -> Result<(), IoError>
Deregister an IO stream.
sourcepub fn update_registration(&self, token: StreamToken) -> Result<(), IoError>
pub fn update_registration(&self, token: StreamToken) -> Result<(), IoError>
Reregister an IO stream.
sourcepub fn message(&self, message: Message) -> Result<(), IoError>
pub fn message(&self, message: Message) -> Result<(), IoError>
Broadcast a message to other IO clients
pub fn handle( &self, peer: usize, handler_id: usize, msg: Message ) -> Result<(), IoError>
sourcepub fn unregister_handler(&self)
pub fn unregister_handler(&self)
Unregister current IO handler.
Trait Implementations§
Auto Trait Implementations§
impl<Message> !RefUnwindSafe for IoContext<Message>
impl<Message> Send for IoContext<Message>
impl<Message> Sync for IoContext<Message>
impl<Message> Unpin for IoContext<Message>
impl<Message> !UnwindSafe for IoContext<Message>
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