Struct skylane::client::Bundle
[−]
[src]
pub struct Bundle { /* fields omitted */ }
Bundle
is passed to objects while invocation of their methods and can be used by them to
add/remove new objects or access socket. It also serves this crate internally as data store.
Methods
impl Bundle
[src]
fn get_socket(&self) -> Socket
Returns connection socket.
fn get_next_available_client_object_id(&self) -> ObjectId
Returns next available client object ID.
If no objects are registered this will be DISPLAY_ID
. Otherwise ID one bigger than the
biggest ID.
fn add_object(&mut self, id: ObjectId, object: Box<Object>)
Adds new object. From now client requests or server events to object with given id
will
be passed to this object
. If another object is already assigned to this id
the
assignment will be overridden.
Here the only requirement for the object is to implement Object
trait. In practical use
one will pass implementations of Interface
traits from protocol definitions wrapped in
Handler
structure with Dispatcher
attached as defined in skylane_protocols
crate.
fn add_next_client_object(&mut self, object: Box<Object>) -> ObjectId
Gets next available client object ID and adds new object. Returns ID of newly added object.
fn remove_object(&mut self, id: ObjectId)
Removes object with given id
.