pub trait PermissionExt: IsA<Permission> + 'static {
Show 13 methods
// Provided methods
fn acquire(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error> { ... }
fn acquire_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
) { ... }
fn acquire_future(
&self,
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... }
fn is_allowed(&self) -> bool { ... }
fn can_acquire(&self) -> bool { ... }
fn can_release(&self) -> bool { ... }
fn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool) { ... }
fn release(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error> { ... }
fn release_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
) { ... }
fn release_future(
&self,
) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>> { ... }
fn connect_allowed_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_can_acquire_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn connect_can_release_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
Sourcefn acquire(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn acquire( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Attempts to acquire the permission represented by @self.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. A simple example is that a dialog may appear asking the user to enter their password.
You should check with g_permission_get_can_acquire() before calling this function.
If the permission is acquired then true
is returned. Otherwise,
false
is returned and @error is set appropriately.
This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_acquire_async() for the non-blocking version.
§cancellable
a #GCancellable, or None
§Returns
true
if the permission was successfully acquired
Sourcefn acquire_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn acquire_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
fn acquire_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
Sourcefn is_allowed(&self) -> bool
fn is_allowed(&self) -> bool
Sourcefn can_acquire(&self) -> bool
fn can_acquire(&self) -> bool
Sourcefn can_release(&self) -> bool
fn can_release(&self) -> bool
Sourcefn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool)
fn impl_update(&self, allowed: bool, can_acquire: bool, can_release: bool)
This function is called by the #GPermission implementation to update the properties of the permission. You should never call this function except from a #GPermission implementation.
GObject notify signals are generated, as appropriate.
§allowed
the new value for the ‘allowed’ property
§can_acquire
the new value for the ‘can-acquire’ property
§can_release
the new value for the ‘can-release’ property
Sourcefn release(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
) -> Result<(), Error>
fn release( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<(), Error>
Attempts to release the permission represented by @self.
The precise method by which this happens depends on the permission and the underlying authentication mechanism. In most cases the permission will be dropped immediately without further action.
You should check with g_permission_get_can_release() before calling this function.
If the permission is released then true
is returned. Otherwise,
false
is returned and @error is set appropriately.
This call is blocking, likely for a very long time (in the case that user interaction is required). See g_permission_release_async() for the non-blocking version.
§cancellable
a #GCancellable, or None
§Returns
true
if the permission was successfully released
Sourcefn release_async<P: FnOnce(Result<(), Error>) + 'static>(
&self,
cancellable: Option<&impl IsA<Cancellable>>,
callback: P,
)
fn release_async<P: FnOnce(Result<(), Error>) + 'static>( &self, cancellable: Option<&impl IsA<Cancellable>>, callback: P, )
fn release_future( &self, ) -> Pin<Box_<dyn Future<Output = Result<(), Error>> + 'static>>
fn connect_allowed_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_can_acquire_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_can_release_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.