Skip to main content

Crate wayle_core

Crate wayle_core 

Source
Expand description

Reactive state for Wayle services. Wrap a value in Property<T> and consumers can .get() it or .watch() for a stream of changes.

use wayle_core::Property;
use futures::stream::StreamExt;

let brightness = Property::new(75u32);
brightness.set(100);

let mut changes = brightness.watch();
while let Some(level) = changes.next().await {
    println!("{level}");
}

Also includes D-Bus macros (unwrap_*!, watch_all!) for extracting properties with type-safe defaults.

Enable schema for [schemars::JsonSchema] support on Property<T>.

Modules§

paths
XDG Base Directory path resolution.

Macros§

remove_and_cancel
Removes items from a Property<Vec<T>> whose object_path matches $target_path, cancelling their CancellationToken before removal.
unwrap_dbus
Extracts a value from a D-Bus property Result, returning Default::default() on error and logging the failure at debug level.
unwrap_dbus_or
Like unwrap_dbus! but returns a specific fallback value instead of Default::default().
watch_all
Merges .watch() streams from multiple Property fields into a single stream that clones and emits the parent struct whenever any field changes.

Structs§

Property
A value you can .get() or .watch() for changes.

Constants§

NULL_PATH
D-Bus null object path (no associated object).
ROOT_PATH
D-Bus root object path.

Type Aliases§

DeferredService
A Property holding a service that initializes in the background. Starts None, becomes Some once the service is ready.
PropertyStream
Stream of property value changes.