pub trait Role<S: Shell>: Any {
    // Required methods
    fn name(&self) -> &'static str;
    fn is_active(&self) -> bool;
    fn deactivate(&mut self, shell: &mut S);

    // Provided methods
    fn provide<'a>(&'a self, _demand: &mut Demand<'a>) { ... }
    fn provide_mut<'a>(&'a mut self, _demand: &mut Demand<'a>) { ... }
    fn pre_commit(
        &mut self,
        _shell: &mut S,
        _surfacee: &Surface<S>
    ) -> Result<(), &'static str> { ... }
    fn post_commit(&mut self, _shell: &mut S, _surface: &Surface<S>) { ... }
}
Expand description

A surface role

Required Methods§

source

fn name(&self) -> &'static str

The name of the interface of this role.

source

fn is_active(&self) -> bool

Returns true if the role is active.

As specified by the wayland protocol, a surface can be assigned a role, then have the role object destroyed. This makes the role “inactive”, but the surface cannot be assigned a different role. So we keep the role object but “deactivate” it.

source

fn deactivate(&mut self, shell: &mut S)

Deactivate the role.

Provided Methods§

source

fn provide<'a>(&'a self, _demand: &mut Demand<'a>)

Provides type based access to member variables of this role.

source

fn provide_mut<'a>(&'a mut self, _demand: &mut Demand<'a>)

Provides type based access to member variables of this role.

source

fn pre_commit( &mut self, _shell: &mut S, _surfacee: &Surface<S> ) -> Result<(), &'static str>

Called before the pending state becomes the current state, in Surface::commit. If an error is returned, the commit will be stopped.

source

fn post_commit(&mut self, _shell: &mut S, _surface: &Surface<S>)

Called after the pending state becomes the current state, in Surface::commit

Trait Implementations§

source§

impl<S: Shell> Provider for dyn Role<S>

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

source§

fn provide_mut<'a>(&'a mut self, demand: &mut Demand<'a>)

Implementors§

source§

impl<S: Shell> Role<S> for Surface

source§

impl<S: Shell> Role<S> for Subsurface<S>

source§

impl<S: XdgShell> Role<S> for TopLevel