pub trait GlobalHandler<D>:
Any
+ Send
+ Sync {
// Required method
fn bind(
self: Arc<Self>,
handle: &Handle,
data: &mut D,
client_id: ClientId,
global_id: GlobalId,
object_id: ObjectId,
) -> Arc<dyn ObjectData<D>>;
// Provided methods
fn can_view(
&self,
_client_id: ClientId,
_client_data: &Arc<dyn ClientData>,
_global_id: GlobalId,
) -> bool { ... }
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error> { ... }
}Expand description
A trait representing the handling of new bound globals
Required Methods§
Sourcefn bind(
self: Arc<Self>,
handle: &Handle,
data: &mut D,
client_id: ClientId,
global_id: GlobalId,
object_id: ObjectId,
) -> Arc<dyn ObjectData<D>>
fn bind( self: Arc<Self>, handle: &Handle, data: &mut D, client_id: ClientId, global_id: GlobalId, object_id: ObjectId, ) -> Arc<dyn ObjectData<D>>
A global has been bound
Given client bound given global, creating given object.
The method must return the object data for the newly created object.
Provided Methods§
Sourcefn can_view(
&self,
_client_id: ClientId,
_client_data: &Arc<dyn ClientData>,
_global_id: GlobalId,
) -> bool
fn can_view( &self, _client_id: ClientId, _client_data: &Arc<dyn ClientData>, _global_id: GlobalId, ) -> bool
Check if given client is allowed to interact with given global
If this function returns false, the client will not be notified of the existence of this global, and any attempt to bind it will result in a protocol error as if the global did not exist.
Default implementation always return true.