use std::panic::RefUnwindSafe;
use anyhow::Result;
use async_trait::async_trait;
#[derive(Clone, Debug)]
pub struct DesiredProperties {
pub version: u64,
pub values: String,
}
pub trait DesiredPropertiesUpdatedCallback: Send + Sync + RefUnwindSafe {
fn properties_updated(&self, properties: DesiredProperties) -> Result<()>;
}
#[async_trait]
pub trait TwinsClient: Send + Sync {
async fn get_twins(&self);
async fn get_reported_properties(&self) -> Option<String>;
async fn set_reported_properties(&self, patch: &str) -> Result<()>;
async fn patch_reported_properties(&self, patch: &str) -> Result<()>;
async fn get_desired_properties(&self) -> Result<DesiredProperties>;
async fn get_desired_properties_if_newer(&self, version: u64) -> Option<DesiredProperties>;
async fn desired_properties_changed(&self) -> Result<DesiredProperties>;
async fn pending_reported_properties_updates(&self) -> Result<bool>;
async fn wait_properties_ready(&self) -> Result<()>;
}