pub struct Registry { /* private fields */ }Expand description
A collection of autostart providers.
Construct with Registry::with_defaults for the built-in providers, or
Registry::new to inject a caller-supplied set (the extension point for
external crates that ship their own providers).
use runlatch_core::Registry;
let registry = Registry::with_defaults();
let result = registry.all_entries().await;
for entry in &result.entries {
println!("{}:{} (enabled={})", entry.source, entry.id, entry.enabled);
}Implementations§
Source§impl Registry
impl Registry
Sourcepub fn new(providers: Vec<Box<dyn AutostartProvider>>) -> Self
pub fn new(providers: Vec<Box<dyn AutostartProvider>>) -> Self
Build a registry from an explicit list of providers.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Build a registry with the crate’s built-in providers: XDG autostart (user and system) and systemd units (user and system).
Sourcepub fn providers(&self) -> &[Box<dyn AutostartProvider>]
pub fn providers(&self) -> &[Box<dyn AutostartProvider>]
All registered providers, regardless of availability.
Sourcepub async fn available(&self) -> Vec<&dyn AutostartProvider>
pub async fn available(&self) -> Vec<&dyn AutostartProvider>
The providers whose is_available probe
currently returns true.
Sourcepub fn find_provider(&self, id: &str) -> Option<&dyn AutostartProvider>
pub fn find_provider(&self, id: &str) -> Option<&dyn AutostartProvider>
Look up a registered provider by its id.
Sourcepub async fn all_entries(&self) -> AggregateResult
pub async fn all_entries(&self) -> AggregateResult
Aggregate entries across every available provider.
A failure from one provider is collected into
AggregateResult::errors and never aborts aggregation of the others.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Registry
impl !UnwindSafe for Registry
impl Freeze for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more