Struct logind_zbus::ManagerProxy[][src]

pub struct ManagerProxy<'a>(_);

Proxy wrapper for the logind Manager dbus interface

Example

use logind_zbus::ManagerProxy;
use zbus::Connection;

let connection = Connection::new_system().unwrap();
let manager = ManagerProxy::new(&connection).unwrap();

assert!(manager.can_suspend().is_ok());

Notes

All connect_* functions are signals and each of these functions names reflect the underlying generated Proxy call. If desired the wrapped function can be bypassed with:

*<ManagerProxy>.connect_<function name>()

Implementations

impl<'a> ManagerProxy<'a>[src]

pub fn new(connection: &Connection) -> Result<Self>[src]

pub fn activate_session(&self, session_id: &str) -> Result<()>[src]

Brings the session with the specified ID into the foreground

pub fn activate_session_on_seat(
    &self,
    session_id: &str,
    seat_id: &str
) -> Result<()>
[src]

Brings the session with the specified ID into the foreground if the seat ID matches

pub fn attach_device(
    &self,
    seat_id: &str,
    sysfs_path: &str,
    interactive: bool
) -> Result<()>
[src]

Used to assign a specific device to a specific seat. The device is identified by its /sys/ path and must be eligible for seat assignments

pub fn can_halt(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_hibernate(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_hybrid_sleep(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_power_off(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_reboot(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_reboot_parameter(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_reboot_to_boot_loader_entry(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_reboot_to_boot_loader_menu(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_reboot_to_firmware_setup(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_suspend(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn can_suspend_then_hibernate(&self) -> Result<IsSupported>[src]

Check if supported and the calling user is allowed to execute it

pub fn cancel_scheduled_shutdown(&self) -> Result<bool>[src]

pub fn flush_devices(&self, interactive: bool) -> Result<()>[src]

pub fn get_seat(&self, seat_id: &str) -> Result<OwnedObjectPath>[src]

pub fn get_session(&self, session_id: &str) -> Result<OwnedObjectPath>[src]

pub fn get_session_by_pid(&self, pid: u32) -> Result<OwnedObjectPath>[src]

pub fn get_user(&self, uid: u32) -> Result<OwnedObjectPath>[src]

pub fn get_user_by_pid(&self, pid: u32) -> Result<OwnedObjectPath>[src]

pub fn halt(&self, interactive: bool) -> Result<()>[src]

pub fn hibernate(&self, interactive: bool) -> Result<()>[src]

pub fn inhibit(
    &self,
    what: &str,
    who: &str,
    why: &str,
    mode: &str
) -> Result<RawFd>
[src]

pub fn hybrid_sleep(&self, interactive: bool) -> Result<()>[src]

pub fn kill_session(
    &self,
    session_id: &str,
    who: &str,
    signal_number: i32
) -> Result<()>
[src]

pub fn kill_user(&self, uid: u32, signal_number: i32) -> Result<()>[src]

pub fn list_inhibitors(
    &self
) -> Result<Vec<(String, String, String, String, u32, u32)>>
[src]

pub fn list_seats(&self) -> Result<Vec<SeatPath>>[src]

pub fn list_sessions(&self) -> Result<Vec<SessionInfo>>[src]

pub fn list_users(&self) -> Result<Vec<UserInfo>>[src]

pub fn lock_session(&self, session_id: &str) -> Result<()>[src]

pub fn lock_sessions(&self) -> Result<()>[src]

pub fn power_off(&self, interactive: bool) -> Result<()>[src]

pub fn reboot(&self, interactive: bool) -> Result<()>[src]

pub fn release_session(&self, session_id: &str) -> Result<()>[src]

pub fn schedule_shutdown(
    &self,
    shutdown_type: ShutdownType,
    micros: Duration
) -> Result<()>
[src]

pub fn set_reboot_parameter(&self, parameter: &str) -> Result<()>[src]

pub fn set_reboot_to_boot_loader_entry(
    &self,
    boot_loader_entry: &str
) -> Result<()>
[src]

pub fn set_reboot_to_boot_loader_menu(&self, timeout: Duration) -> Result<()>[src]

pub fn set_reboot_to_firmware_setup(&self, enable: bool) -> Result<()>[src]

pub fn set_user_linger(
    &self,
    uid: u32,
    enable: bool,
    interactive: bool
) -> Result<()>
[src]

pub fn set_wall_message(&self, wall_message: &str, enable: bool) -> Result<()>[src]

pub fn suspend(&self, interactive: bool) -> Result<()>[src]

pub fn suspend_then_hibernate(&self, interactive: bool) -> Result<()>[src]

pub fn terminate_seat(&self, seat_id: &str) -> Result<()>[src]

pub fn terminate_session(&self, session_id: &str) -> Result<()>[src]

pub fn terminate_user(&self, uid: u32) -> Result<()>[src]

pub fn unlock_session(&self, session_id: &str) -> Result<()>[src]

pub fn unlock_sessions(&self) -> Result<()>[src]

pub fn get_block_inhibited(&self) -> Result<String>[src]

pub fn get_boot_loader_entries(&self) -> Result<Vec<String>>[src]

pub fn get_delay_inhibited(&self) -> Result<String>[src]

pub fn get_docked(&self) -> Result<bool>[src]

pub fn set_enable_wall_messages(&self, value: bool) -> Result<()>[src]

pub fn get_handle_hibernate_key(&self) -> Result<String>[src]

pub fn get_handle_lid_switch(&self) -> Result<String>[src]

pub fn get_handle_lid_switch_docked(&self) -> Result<String>[src]

pub fn get_handle_lid_switch_external_power(&self) -> Result<String>[src]

pub fn get_handle_power_key(&self) -> Result<String>[src]

pub fn get_handle_suspend_key(&self) -> Result<String>[src]

pub fn get_holdoff_timeout_usec(&self) -> Result<Duration>[src]

pub fn get_idle_action(&self) -> Result<String>[src]

pub fn get_idle_action_usec(&self) -> Result<Duration>[src]

pub fn get_idle_hint(&self) -> Result<bool>[src]

pub fn get_idle_since_hint(&self) -> Result<Duration>[src]

pub fn get_idle_since_hint_monotonic(&self) -> Result<Duration>[src]

pub fn get_inhibit_delay_max_usec(&self) -> Result<Duration>[src]

pub fn get_inhibitors_max(&self) -> Result<u64>[src]

pub fn get_kill_exclude_users(&self) -> Result<Vec<String>>[src]

pub fn get_kill_only_users(&self) -> Result<Vec<String>>[src]

pub fn get_kill_user_processes(&self) -> Result<bool>[src]

pub fn get_lid_closed(&self) -> Result<bool>[src]

pub fn get_nauto_vts(&self) -> Result<u32>[src]

pub fn get_ncurrent_inhibitors(&self) -> Result<u64>[src]

pub fn get_ncurrent_sessions(&self) -> Result<u64>[src]

pub fn get_on_external_power(&self) -> Result<bool>[src]

pub fn get_preparing_for_shutdown(&self) -> Result<bool>[src]

pub fn get_preparing_for_sleep(&self) -> Result<bool>[src]

pub fn get_reboot_parameter(&self) -> Result<String>[src]

pub fn get_reboot_to_boot_loader_entry(&self) -> Result<String>[src]

pub fn get_reboot_to_boot_loader_menu(&self) -> Result<u64>[src]

pub fn get_reboot_to_firmware_setup(&self) -> Result<bool>[src]

pub fn get_remove_ipc(&self) -> Result<bool>[src]

pub fn get_runtime_directory_inodes_max(&self) -> Result<u64>[src]

pub fn get_runtime_directory_size(&self) -> Result<u64>[src]

pub fn get_scheduled_shutdown(&self) -> Result<ScheduledShutdown>[src]

pub fn get_sessions_max(&self) -> Result<u64>[src]

pub fn get_user_stop_delay_usec(&self) -> Result<Duration>[src]

pub fn get_wall_message(&self) -> Result<String>[src]

pub fn connect_prepare_for_shutdown<C>(
    &self,
    callback: C
) -> Result<SignalHandlerId> where
    C: FnMut(bool) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_prepare_for_sleep<C>(
    &self,
    callback: C
) -> Result<SignalHandlerId> where
    C: FnMut(bool) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_new_seat<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(&str, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_seat_removed<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(&str, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_new_session<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(&str, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_session_removed<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(&str, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_new_user<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(u32, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

pub fn connect_user_removed<C>(&self, callback: C) -> Result<SignalHandlerId> where
    C: FnMut(u32, OwnedObjectPath) -> Result<(), Error> + Send + 'static, 
[src]

Methods from Deref<Target = Proxy<'a>>

pub fn connection(&self) -> &Connection[src]

Get a reference to the associated connection.

pub fn destination(&self) -> &str[src]

Get a reference to the destination service name.

pub fn path(&self) -> &ObjectPath<'_>[src]

Get a reference to the object path.

pub fn interface(&self) -> &str[src]

Get a reference to the interface.

pub fn introspect(&self) -> Result<String, Error>[src]

Introspect the associated object, and return the XML description.

See the xml module for parsing the result.

pub fn get_property<T>(&self, property_name: &str) -> Result<T, Error> where
    T: TryFrom<OwnedValue>, 
[src]

Get the property property_name.

Effectively, call the Get method of the org.freedesktop.DBus.Properties interface.

pub fn set_property<'t, T>(
    &self,
    property_name: &str,
    value: T
) -> Result<(), Error> where
    T: 't + Into<Value<'t>>, 
[src]

Set the property property_name.

Effectively, call the Set method of the org.freedesktop.DBus.Properties interface.

pub fn call_method<B>(
    &self,
    method_name: &str,
    body: &B
) -> Result<Message, Error> where
    B: Serialize + Type
[src]

Call a method and return the reply.

Typically, you would want to use call method instead. Use this method if you need to deserialize the reply message manually (this way, you can avoid the memory allocation/copying, by deserializing the reply to an unowned type).

pub fn call<B, R>(&self, method_name: &str, body: &B) -> Result<R, Error> where
    B: Serialize + Type,
    R: DeserializeOwned + Type
[src]

Call a method and return the reply body.

Use call_method instead if you need to deserialize the reply manually/separately.

pub fn connect_signal<H>(
    &self,
    signal_name: &'static str,
    handler: H
) -> Result<SignalHandlerId, Error> where
    H: FnMut(&Message) -> Result<(), Error> + Send + 'static, 
[src]

Register a handler for signal named signal_name.

Once a handler is successfully registered, call Self::next_signal to wait for the next signal to arrive and be handled by its registered handler. A unique ID for the handler is returned, which can be used to deregister this handler using Self::disconnect_signal method.

Errors

This method can fail if addition of the relevant match rule on the bus fails. You can safely unwrap the Result if you’re certain that associated connnection is not a bus connection.

pub fn disconnect_signal(
    &self,
    handler_id: SignalHandlerId
) -> Result<bool, Error>
[src]

Deregister the signal handler with the ID handler_id.

This method returns Ok(true) if a handler with the id handler_id is found and removed; Ok(false) otherwise.

Errors

This method can fail if removal of the relevant match rule on the bus fails. You can safely unwrap the Result if you’re certain that associated connnection is not a bus connection.

pub fn next_signal(&self) -> Result<Option<Message>, Error>[src]

Receive and handle the next incoming signal on the associated connection.

This method will wait for signal messages on the associated connection and call any handlers registered through the Self::connect_signal method. Signal handlers can be registered and deregistered from another threads during the call to this method.

If the signal message was handled by a handler, Ok(None) is returned. Otherwise, the received message is returned.

Errors

Apart from general I/O errors that can result from socket communications, calling this method will also result in an error if the destination service has not yet registered its well-known name with the bus (assuming you’re using the well-known name as destination).

pub fn handle_signal(&self, msg: &Message) -> Result<bool, Error>[src]

Handle the provided signal message.

Call any handlers registered through the Self::connect_signal method for the provided signal message.

If no errors are encountered, Ok(true) is returned if a handler was found and called for, the signal; Ok(false) otherwise.

pub fn inner(&self) -> &Proxy<'_>[src]

Get a reference to the underlying async Proxy.

Trait Implementations

impl<'a> AsMut<Proxy<'a>> for ManagerProxy<'a>[src]

impl<'a> AsRef<Proxy<'a>> for ManagerProxy<'a>[src]

impl<'a> Deref for ManagerProxy<'a>[src]

type Target = Proxy<'a>

The resulting type after dereferencing.

impl<'a> DerefMut for ManagerProxy<'a>[src]

Auto Trait Implementations

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

impl<'a> Send for ManagerProxy<'a>

impl<'a> Sync for ManagerProxy<'a>

impl<'a> Unpin for ManagerProxy<'a>

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,