LoginManagerConnection

Struct LoginManagerConnection 

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

An established connection path for the login manager, through which the API is made accessible.

Implementations§

Source§

impl<'a> LoginManagerConnection<'a>

Source

pub fn inhibit( &self, what: &str, who: &str, why: &str, mode: &str, ) -> Result<OwnedFd, Error>

Inhibit is the only API necessary to take a lock. It takes four arguments:

  • What is a colon-separated list of lock types, i.e. shutdown, sleep, idle, handle-power-key, handle-suspend-key, handle-hibernate-key, handle-lid-switch. Example: “shutdown:idle”
  • Who is a human-readable, descriptive string of who is taking the lock. Example: “Package Updater”
  • Why is a human-readable, descriptive string of why the lock is taken. Example: “Package Update in Progress”
  • Mode is one of block or delay.
§Notes

A root user session cannot use systemd inhibitors.

Source

pub fn inhibit_suspend(&self, who: &str, why: &str) -> Result<OwnedFd, Error>

Convenience method for inhibiting suspend.

Equivalent to connection.inhibit("idle:shutdown:sleep", who, why, "block").

Auto Trait Implementations§

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.