[][src]Struct ashpd::SessionProxy

pub struct SessionProxy<'a> { /* fields omitted */ }

The Session interface is shared by all portal interfaces that involve long lived sessions. When a method that creates a session is called, if successful, the reply will include a session handle (i.e. object path) for a Session object, which will stay alive for the duration of the session.

The duration of the session is defined by the interface that creates it. For convenience, the interface contains a method Close(), and a signal org.freedesktop.portal.Session::Closed. Whether it is allowed to directly call Close() depends on the interface.

The handle of a session will be of the form /org/freedesktop/portal/desktop/session/SENDER/TOKEN, where SENDER is the callers unique name, with the initial ':' removed and all '.' replaced by '_', and TOKEN is a unique token that the caller provided with the session_handle_token key in the options vardict of the method creating the session.

The token that the caller provides should be unique and not guessable. To avoid clashes with calls made from unrelated libraries, it is a good idea to use a per-library prefix combined with a random number.

A client who started a session vanishing from the D-Bus is equivalent to closing all active sessions made by said client.

Implementations

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

pub fn new(
    connection: &'a Connection,
    handle: &'a ObjectPath<'_>
) -> Result<Self>
[src]

Creates a new session proxy.

Arguments

  • connection - A DBus session connection.
  • handle - An object path returned by a portal call that creates a session.

pub fn on_closed<F>(&self, callback: F) -> Result<()> where
    F: FnOnce(HashMap<String, OwnedValue>) -> Result<()>, 
[src]

Emitted when a session is closed.

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

Closes the portal session to which this object refers and ends all related user interaction (dialogs, etc).

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

version property

Auto Trait Implementations

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

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

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

impl<'a> Unpin for SessionProxy<'a>

impl<'a> !UnwindSafe for SessionProxy<'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.