pub trait Fetchable: SonosProperty {
type Operation: UPnPOperation;
// Required methods
fn build_operation( ) -> Result<ComposableOperation<Self::Operation>, SdkError>;
fn from_response(
response: <Self::Operation as UPnPOperation>::Response,
) -> Self;
}Expand description
Trait for properties that can be fetched from the device
This trait defines how to fetch a property value from a Sonos device. Each property type that supports fetching must implement this trait.
§Type Parameters
Op: The UPnP operation type used to fetch this property
§Example
ⓘ
impl Fetchable for Volume {
type Operation = GetVolumeOperation;
fn build_operation() -> Result<ComposableOperation<Self::Operation>, SdkError> {
rendering_control::get_volume_operation("Master".to_string())
.build()
.map_err(|e| SdkError::FetchFailed(e.to_string()))
}
fn from_response(response: GetVolumeResponse) -> Self {
Volume::new(response.current_volume)
}
}Required Associated Types§
Sourcetype Operation: UPnPOperation
type Operation: UPnPOperation
The UPnP operation type used to fetch this property
Required Methods§
Sourcefn build_operation() -> Result<ComposableOperation<Self::Operation>, SdkError>
fn build_operation() -> Result<ComposableOperation<Self::Operation>, SdkError>
Build the operation to fetch this property
Sourcefn from_response(response: <Self::Operation as UPnPOperation>::Response) -> Self
fn from_response(response: <Self::Operation as UPnPOperation>::Response) -> Self
Convert the operation response to the property value
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.