Trait Session

Source
pub trait Session {
    type Error: AsErrno;

    // Required methods
    fn open(
        &mut self,
        path: &Path,
        flags: OFlags,
    ) -> Result<OwnedFd, Self::Error>;
    fn close(&mut self, fd: OwnedFd) -> Result<(), Self::Error>;
    fn change_vt(&mut self, vt: i32) -> Result<(), Self::Error>;
    fn is_active(&self) -> bool;
    fn seat(&self) -> String;
}
Available on crate feature backend_session only.
Expand description

General session interface.

Provides a way to open and close devices and change the active vt.

Required Associated Types§

Source

type Error: AsErrno

Error type of the implementation

Required Methods§

Source

fn open(&mut self, path: &Path, flags: OFlags) -> Result<OwnedFd, Self::Error>

Opens a device at the given path with the given flags.

Returns a raw file descriptor

Source

fn close(&mut self, fd: OwnedFd) -> Result<(), Self::Error>

Close a previously opened file descriptor

Source

fn change_vt(&mut self, vt: i32) -> Result<(), Self::Error>

Change the currently active virtual terminal

Source

fn is_active(&self) -> bool

Check if this session is currently active

Source

fn seat(&self) -> String

Which seat this session is on

Implementations on Foreign Types§

Source§

impl Session for ()

Source§

type Error = ()

Source§

fn open(&mut self, _path: &Path, _flags: OFlags) -> Result<OwnedFd, Self::Error>

Source§

fn close(&mut self, _fd: OwnedFd) -> Result<(), Self::Error>

Source§

fn change_vt(&mut self, _vt: i32) -> Result<(), Self::Error>

Source§

fn is_active(&self) -> bool

Source§

fn seat(&self) -> String

Source§

impl<S: Session> Session for Rc<RefCell<S>>

Source§

type Error = <S as Session>::Error

Source§

fn open(&mut self, path: &Path, flags: OFlags) -> Result<OwnedFd, Self::Error>

Source§

fn close(&mut self, fd: OwnedFd) -> Result<(), Self::Error>

Source§

fn change_vt(&mut self, vt: i32) -> Result<(), Self::Error>

Source§

fn is_active(&self) -> bool

Source§

fn seat(&self) -> String

Source§

impl<S: Session> Session for Arc<Mutex<S>>

Source§

type Error = <S as Session>::Error

Source§

fn open(&mut self, path: &Path, flags: OFlags) -> Result<OwnedFd, Self::Error>

Source§

fn close(&mut self, fd: OwnedFd) -> Result<(), Self::Error>

Source§

fn change_vt(&mut self, vt: i32) -> Result<(), Self::Error>

Source§

fn is_active(&self) -> bool

Source§

fn seat(&self) -> String

Implementors§

Source§

impl Session for LibSeatSession

Available on crate feature backend_session_libseat only.