pub trait RunnerExt:
Runner
+ Sized
+ Send
+ 'static {
// Required methods
fn start(
self,
service: &'static str,
path: &'static str,
) -> Result<(), Error>;
fn register(cr: &mut Crossroads) -> IfaceToken<Self>;
}
Expand description
Helper methods for Runner
s.
Required Methods§
Sourcefn start(self, service: &'static str, path: &'static str) -> Result<(), Error>
fn start(self, service: &'static str, path: &'static str) -> Result<(), Error>
Starts running this runner on the main thread indefinitely.
This is a convenience function that starts a new D-Bus connection,
requests the given service name, registers the KRunner
interface, and starts indefinitely listening on the
session bus.
§Example
ⓘ
use krunner::RunnerExt;
struct Runner;
impl krunner::Runner for Runner {
// ...
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
Runner.start("some.runner.path", "/SomeRunner")?;
Ok(())
}
Sourcefn register(cr: &mut Crossroads) -> IfaceToken<Self>
fn register(cr: &mut Crossroads) -> IfaceToken<Self>
Registers the KRunner interface for this runner to a Crossroads
instance.
Usually, you can just use the start
method to start the
runner. However, if you ever need to customize the D-Bus connection or how
exactly the D-Bus server should react to events, this is the method to
call.
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.