Skip to main content

DeviceStoreHarness

Trait DeviceStoreHarness 

Source
pub trait DeviceStoreHarness: Send + Sync {
    // Required method
    fn open<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Arc<dyn DeviceStore>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn is_durable(&self) -> bool { ... }
}
Expand description

Opens a DeviceStore backend for the conformance suite.

§Example

use std::sync::Arc;
use adk_kernel::conformance::DeviceStoreHarness;
use adk_kernel::pairing::{DeviceStore, InMemoryDeviceStore};

struct InMemory;

#[async_trait::async_trait]
impl DeviceStoreHarness for InMemory {
    async fn open(&self) -> Arc<dyn DeviceStore> {
        Arc::new(InMemoryDeviceStore::new())
    }

    fn is_durable(&self) -> bool {
        false
    }
}

Required Methods§

Source

fn open<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn DeviceStore>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Opens a store. For a durable backend every call returns a new handle over the same stored data. Panics when the backend cannot be opened.

Provided Methods§

Source

fn is_durable(&self) -> bool

Whether data written through one handle is visible through the next.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§