ObjectCoreApi

Trait ObjectCoreApi 

Source
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§

Source

fn state(&self) -> &Rc<State>

Returns the State of this object.

Source

fn client(&self) -> Option<Rc<Client>>

Returns the Client associated with this object, if any.

Source

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())
Source

fn interface(&self) -> ObjectInterface

Returns the ObjectInterface of this object.

Source

fn version(&self) -> u32

Returns the version of this object.

Source

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.

Source

fn client_id(&self) -> Option<u32>

Returns the client ID of this object, if any.

Source

fn server_id(&self) -> Option<u32>

Returns the server ID of this object, if any.

Source

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.

Source

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.

Source

fn set_forward_to_client(&self, enabled: bool)

Enables or disables automatic forwarding of events to the client.

This affects the default message handlers.

Source

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.

Implementors§