Logind

Struct Logind 

Source
pub struct Logind<'a> { /* private fields */ }
Expand description

A logind client connection. This is a relatively thin wrapper over the D-Bus API.

Implementations§

Source§

impl<'a> Logind<'a>

Source

pub fn new(conn: &'a Connection) -> Logind<'_>

Source

pub fn session(&self, id: &SessionId) -> Result<Session<'a>, LogindError>

Get a handle to a logind session by ID.

Source

pub fn current_session(&self) -> Result<Session<'a>, LogindError>

Get a handle to the current logind session.

Source

pub fn suspend(&self, interactive: bool) -> Result<(), LogindError>

Attempt to suspend the system. If interactive, PolicyKit may prompt the current user for authentication if needed.

Source

pub fn reboot(&self, interactive: bool) -> Result<(), LogindError>

Attempt to reboot the system. If interactive, PolicyKit may prompt the current user for authentication.

Source

pub fn power_off(&self, interactive: bool) -> Result<(), LogindError>

Attempt to power off the system. If interactive, PolicyKit may prompt the current user for authentication.

Source

pub fn hibernate(&self, interactive: bool) -> Result<(), LogindError>

Attempt to hibernate the system. If interactive, PolicyKit may prompt the current user for authentication.

Source

pub fn inhibit( &self, who: &str, why: &str, events: &InhibitEventSet, mode: InhibitMode, ) -> Result<InhibitorLock, LogindError>

Source

pub fn on_sleep<F: Fn(Logind<'_>) + Send + 'static, G: Fn(Logind<'_>) + Send + 'static>( &self, pre_sleep: F, post_sleep: G, ) -> Result<(), LogindError>

Auto Trait Implementations§

§

impl<'a> Freeze for Logind<'a>

§

impl<'a> !RefUnwindSafe for Logind<'a>

§

impl<'a> !Send for Logind<'a>

§

impl<'a> !Sync for Logind<'a>

§

impl<'a> Unpin for Logind<'a>

§

impl<'a> !UnwindSafe for Logind<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.