Struct logind_zbus::UserProxy [−][src]
Proxy wrapper for the logind User
dbus interface
All get_*
methods are property getters
Example
use logind_zbus::ManagerProxy; use logind_zbus::UserProxy; use zbus::Connection; let connection = Connection::new_system().unwrap(); let manager = ManagerProxy::new(&connection).unwrap(); let users = manager.list_users().unwrap(); let user = UserProxy::new(&connection, &users[0]).unwrap(); let time1 = user.get_timestamp().unwrap(); assert!(time1.as_secs() > 0); let time2 = user.get_timestamp_monotonic().unwrap(); assert!(time2.as_secs() > 0);
Implementations
impl<'a> UserProxy<'a>
[src]
pub fn new<U>(connection: &Connection, user: &'a U) -> Result<Self> where
U: IntoUserPath,
[src]
U: IntoUserPath,
pub fn kill(&self, signal_number: i32) -> Result<()>
[src]
pub fn terminate(&self) -> Result<()>
[src]
They’ll be back
pub fn get_display(&self) -> Result<DbusPath>
[src]
Property: which graphical session should be used as the primary UI display for the user. It is a structure encoding the session ID and the object path of the session to use.
pub fn get_gid(&self) -> Result<u32>
[src]
Property: primary GID of the user
pub fn get_is_idle_hint(&self) -> Result<bool>
[src]
Property: idle hint state of the user
pub fn get_is_idle_since_hint(&self) -> Result<Duration>
[src]
Property: idle hint state of the user
pub fn get_is_idle_since_hint_monotonic(&self) -> Result<Duration>
[src]
Property: idle hint state of the user
pub fn get_linger(&self) -> Result<bool>
[src]
Property: shows whether lingering is enabled for this user
pub fn get_name(&self) -> Result<String>
[src]
Property: Users name
pub fn get_runtime_path(&self) -> Result<String>
[src]
Property: runtime path of the user, i.e. $XDG_RUNTIME_DIR
pub fn get_service(&self) -> Result<String>
[src]
Property: the unit name of the user systemd service of this user.
Each logged in user is assigned a user service that runs a user
systemd instance. This is usually an instance of user@.service
.
pub fn get_slice(&self) -> Result<String>
[src]
Property: unit name of the user systemd slice of this user. Each logged in user gets a private slice.
pub fn get_state(&self) -> Result<UserState>
[src]
Property: Users state
pub fn get_timestamp(&self) -> Result<Duration>
[src]
Property: login time of the user in microseconds since the epoch (realtime)
pub fn get_timestamp_monotonic(&self) -> Result<Duration>
[src]
Property: login time of the user in microseconds since the epoch (walltime)
pub fn get_uid(&self) -> Result<u32>
[src]
Property: Unix UID of the user
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]
T: TryFrom<OwnedValue>,
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]
&self,
property_name: &str,
value: T
) -> Result<(), Error> where
T: 't + Into<Value<'t>>,
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]
&self,
method_name: &str,
body: &B
) -> Result<Message, Error> where
B: Serialize + Type,
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]
B: Serialize + Type,
R: DeserializeOwned + Type,
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]
&self,
signal_name: &'static str,
handler: H
) -> Result<SignalHandlerId, Error> where
H: FnMut(&Message) -> Result<(), Error> + Send + 'static,
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]
&self,
handler_id: SignalHandlerId
) -> Result<bool, Error>
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 UserProxy<'a>
[src]
impl<'a> AsRef<Proxy<'a>> for UserProxy<'a>
[src]
impl<'a> Deref for UserProxy<'a>
[src]
type Target = Proxy<'a>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'a> DerefMut for UserProxy<'a>
[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for UserProxy<'a>
impl<'a> Send for UserProxy<'a>
impl<'a> Sync for UserProxy<'a>
impl<'a> Unpin for UserProxy<'a>
impl<'a> !UnwindSafe for UserProxy<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,