pub trait PlatformProvider: Send + Sync {
// Required methods
fn instance_uid<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn secret_store<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, PlatformError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn crypto(&self) -> Arc<dyn CryptoProvider> ⓘ;
}Expand description
Composite platform provider — the three OS-level services a Hyper needs.
Deliberately narrow and noun-shaped: each method answers one question.
| Method | Question |
|---|---|
instance_uid | “What’s my stable ID, across restarts?” |
secret_store | “Where do I keep actor credentials?” |
crypto | “How do I verify signatures?” |
Implementations own their own root (a filesystem dir on native, a localStorage prefix on web) and handle setup internally. Callers never think in terms of filesystem paths or directory creation.
Required Methods§
Sourcefn instance_uid<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn instance_uid<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String, PlatformError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Stable instance UID that survives restarts.
Must return the same value for the lifetime of the underlying storage
(e.g. a given data_dir on native, a given localStorage prefix on web).
Sourcefn secret_store<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, PlatformError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn secret_store<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvStore>, PlatformError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Open a namespaced KV store (per-actor credential / PSK storage).
The namespace is supplied by the caller; the provider decides how to combine it with its own root to produce a real storage location.
Sourcefn crypto(&self) -> Arc<dyn CryptoProvider> ⓘ
fn crypto(&self) -> Arc<dyn CryptoProvider> ⓘ
Cryptographic primitives (signature verification, hashing).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".