Struct comm::client::Client
[−]
[src]
pub struct Client { /* fields omitted */ }
A Client
handles receiving, processing, relaying, etc. of messages in the communication
network. It internalizes all the complex logic that is specific to messaging, and exposes a few
commands view a TaskSender
and events via Events
.
Methods
impl Client
[src]
pub fn new(address: Address) -> Client
[src]
Creates a new Client
. address
is the address of this client, i.e. where other clients
should send messages intended for this client.
pub fn run(self, network: Network) -> TaskSender
[src]
Starts a Client
in its own thread and returns its task sender. This method consumes the
Client
, so all event listeners must be registered first.
pub fn register_event_listener(&mut self, event_listener: Sender<Event>)
[src]
Registers an event listener that should be sent every Event
the client emits.
Trait Implementations
impl Handler for Client
[src]
type Timeout = ScheduledTask
type Message = Task
fn notify(&mut self, event_loop: &mut EventLoop<Client>, task: Task)
[src]
Invoked when a message has been received via the event loop's channel.
fn timeout(&mut self, event_loop: &mut EventLoop<Client>, task: ScheduledTask)
[src]
Invoked when a timeout has completed.
fn ready(
&mut self,
event_loop: &mut EventLoop<Self>,
token: Token,
events: EventSet
)
[src]
&mut self,
event_loop: &mut EventLoop<Self>,
token: Token,
events: EventSet
)
Invoked when the socket represented by token
is ready to be operated on. events
indicates the specific operations that are ready to be performed. Read more
fn interrupted(&mut self, event_loop: &mut EventLoop<Self>)
[src]
Invoked when EventLoop
has been interrupted by a signal interrupt.
fn tick(&mut self, event_loop: &mut EventLoop<Self>)
[src]
Invoked at the end of an event loop tick.