Trait Layout

Source
pub trait Layout: 'static {
    type Error: StdError;

    const NAMESPACE: &'static str;

    // Required methods
    fn user_cmd(
        &mut self,
        cmd: String,
        tags: Option<u32>,
        output: &str,
    ) -> Result<(), Self::Error>;
    fn generate_layout(
        &mut self,
        view_count: u32,
        usable_width: u32,
        usable_height: u32,
        tags: u32,
        output: &str,
    ) -> Result<GeneratedLayout, Self::Error>;
}
Expand description

This trait represents a layout generator implementation.

Required Associated Constants§

Source

const NAMESPACE: &'static str

The namespace is used by the compositor to distinguish between layout generators. Two separate clients may not share a namespace. Otherwise, run will return Error::NamespaceInUse.

Required Associated Types§

Source

type Error: StdError

The error type of user_cmd and generate_layout functions. Use Infallible if you don’t need it.

Required Methods§

Source

fn user_cmd( &mut self, cmd: String, tags: Option<u32>, output: &str, ) -> Result<(), Self::Error>

This function is called whenever the user sends a command via riverctl send-layout-cmd.

§Errors

An error returned from this function will be logged, but it will not terminate the application.

Source

fn generate_layout( &mut self, view_count: u32, usable_width: u32, usable_height: u32, tags: u32, output: &str, ) -> Result<GeneratedLayout, Self::Error>

This function is called whenever compositor requests a layout.

§Errors

Returning an error from this fuction will cause run to terminate.

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§