pub trait ObjectCoreApi {
// Required methods
fn state(&self) -> &Rc<State>;
fn client(&self) -> Option<Rc<Client>>;
fn create_child<P>(&self) -> Rc<P>
where P: Object;
fn interface(&self) -> ObjectInterface;
fn version(&self) -> u32;
fn unique_id(&self) -> u64;
fn client_id(&self) -> Option<u32>;
fn server_id(&self) -> Option<u32>;
fn delete_id(&self);
fn try_delete_id(&self) -> Result<(), ObjectError>;
fn set_forward_to_client(&self, enabled: bool);
fn set_forward_to_server(&self, enabled: bool);
}Expand description
The API implemented by ObjectCore.
Required Methods§
Sourcefn create_child<P>(&self) -> Rc<P>where
P: Object,
fn create_child<P>(&self) -> Rc<P>where
P: Object,
Creates a child of this object.
This is a shorthand for
self.state().create_object::<P>(self.version())Sourcefn interface(&self) -> ObjectInterface
fn interface(&self) -> ObjectInterface
Returns the ObjectInterface of this object.
Sourcefn unique_id(&self) -> u64
fn unique_id(&self) -> u64
Returns the unique ID of this object.
This ID is not reused for any other object for the lifetime of the State.
Sourcefn delete_id(&self)
fn delete_id(&self)
Sends a wl_display.delete_id event for this object.
This is similar to ObjectCoreApi::try_delete_id but logs a message instead of
returning an error.
Sourcefn try_delete_id(&self) -> Result<(), ObjectError>
fn try_delete_id(&self) -> Result<(), ObjectError>
Tries to send a wl_display.delete_id event for this object.
This should be used when overriding the delete_id function in message handlers
or in destructors when the destructor is not forwarded to the server.
Sourcefn set_forward_to_client(&self, enabled: bool)
fn set_forward_to_client(&self, enabled: bool)
Enables or disables automatic forwarding of events to the client.
This affects the default message handlers.
Sourcefn set_forward_to_server(&self, enabled: bool)
fn set_forward_to_server(&self, enabled: bool)
Enables or disables automatic forwarding of requests to the server.
This affects the default message handlers.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.