Skip to main content

DriverStoreHarness

Trait DriverStoreHarness 

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

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

Opens a DriverStore backend for the conformance suite.

§Example

use std::sync::Arc;
use adk_kernel::conformance::DriverStoreHarness;
use adk_kernel::drivers::DriverStore;
use adk_kernel::stores::InMemoryDriverStore;

struct InMemory;

#[async_trait::async_trait]
impl DriverStoreHarness for InMemory {
    async fn open(&self) -> Arc<dyn DriverStore> {
        Arc::new(InMemoryDriverStore::new())
    }

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

Required Methods§

Source

fn open<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Arc<dyn DriverStore>> + 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§