Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    // Required methods
    fn open_device(
        &mut self,
        path: &Path,
    ) -> Result<(DeviceId, RawFd), SessionError>;
    fn close_device(&mut self, id: DeviceId) -> Result<(), SessionError>;
    fn acknowledge_pause(&mut self) -> Result<(), SessionError>;
    fn switch_session(&mut self, session: i32) -> Result<(), SessionError>;
    fn poll_fd(&self) -> Option<RawFd>;
    fn dispatch(
        &mut self,
        timeout_ms: i32,
        events: &mut Vec<RawEvent>,
    ) -> Result<(), SessionError>;
}
Expand description

What a seat has to be able to do.

Deliberately small. Everything about when to call these – and what state the session is in between them – is Session’s, so it can be tested against a fake on a machine with no seat.

Required Methods§

Source

fn open_device( &mut self, path: &Path, ) -> Result<(DeviceId, RawFd), SessionError>

Open a device the seat controls.

§Errors

Whatever the seat says, as SessionError::Seat.

Source

fn close_device(&mut self, id: DeviceId) -> Result<(), SessionError>

Close one this session opened.

§Errors

As Backend::open_device.

Source

fn acknowledge_pause(&mut self) -> Result<(), SessionError>

Tell the seat the pause has been acted on.

Until this returns, the seat is waiting: the switch does not complete and the user is looking at a display that has not changed.

§Errors

As Backend::open_device.

Source

fn switch_session(&mut self, session: i32) -> Result<(), SessionError>

Ask to switch to another session, by VT number.

§Errors

As Backend::open_device.

Source

fn poll_fd(&self) -> Option<RawFd>

A descriptor that becomes readable when the seat has something to say.

Source

fn dispatch( &mut self, timeout_ms: i32, events: &mut Vec<RawEvent>, ) -> Result<(), SessionError>

Let the seat deliver whatever it has, appending to events.

§Errors

As Backend::open_device.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Backend for LibseatBackend

Available on crate feature libseat only.