Skip to main content

Property

Trait Property 

Source
pub trait Property:
    Clone
    + Send
    + Sync
    + PartialEq
    + 'static {
    const KEY: &'static str;
}
Expand description

The property trait, re-exported so downstream crates can write code that is generic over properties.

Without this a consumer needing P::KEY — a UI caching watch handles by (speaker, property), say — has to depend on sonos-sdk-state directly and reach past this facade into a crate documented as an implementation detail. That also puts the trait’s breaking changes outside this crate’s version contract, since sonos-sdk-state is not covered by its semver gate. Marker trait for properties that can be stored and watched

Properties must be:

  • Clone: For copying values to watchers
  • Send + Sync: For thread-safe access
  • PartialEq: For change detection (only emit when value actually changes)
  • ’static: For type-erased storage using TypeId

The KEY constant provides a human-readable identifier for debugging, logging, and event filtering.

Required Associated Constants§

Source

const KEY: &'static str

Unique key identifying this property type

Used for debugging, logging, and filtering change events. Should be unique within your application domain.

§Examples
  • "volume" for audio volume
  • "temperature" for sensor readings
  • "connection_state" for network status

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Property for Bass

Source§

const KEY: &'static str = "bass"

Source§

impl Property for GroupMembership

Source§

const KEY: &'static str = "group_membership"

Source§

impl Property for Loudness

Source§

const KEY: &'static str = "loudness"

Source§

impl Property for Mute

Source§

const KEY: &'static str = "mute"

Source§

impl Property for Position

Source§

const KEY: &'static str = "position"

Source§

impl Property for Topology

Source§

const KEY: &'static str = "topology"

Source§

impl Property for Treble

Source§

const KEY: &'static str = "treble"

Implementors§

Source§

impl Property for CurrentTrack

Source§

const KEY: &'static str = "current_track"

Source§

impl Property for GroupMute

Source§

const KEY: &'static str = "group_mute"

Source§

impl Property for GroupVolume

Source§

const KEY: &'static str = "group_volume"

Source§

impl Property for GroupVolumeChangeable

Source§

const KEY: &'static str = "group_volume_changeable"

Source§

impl Property for PlaybackState

Source§

const KEY: &'static str = "playback_state"

Source§

impl Property for Volume

Source§

const KEY: &'static str = "volume"