pub trait SharedReaderKey:
Send
+ Sync
+ 'static {
type Value: Send + 'static;
type Error;
type Subscription: Send + Sync + 'static;
// Required methods
fn identity(&self) -> SharedKeyIdentity;
fn load(
&self,
context: SharedLoadContext<'_, Self::Value>,
) -> impl Future<Output = Result<Option<Self::Value>, Self::Error>> + Send;
fn subscribe(
&self,
context: SharedSubscribeContext,
subscriber: SharedSubscriber<Self::Value>,
) -> Result<Self::Subscription, Self::Error>;
}Expand description
Supplies typed loading and an owned subscription for a stable resource.
Implementations must keep identity stable and represent absence as outer
None, independently of a stored optional value. Subscription guards must
release their provider registration on drop. Retain the supplied weak
subscriber, not an independently captured strong handle to its owner.
Loading before subscribing does not itself prevent missed updates. Specify
the provider’s replay, registration and absence rules when stronger continuity
is required; successful subscription setup is not necessarily delivery acknowledgement.
Required Associated Types§
Sourcetype Subscription: Send + Sync + 'static
type Subscription: Send + Sync + 'static
Resource retained until the final captured reference is dropped.
Required Methods§
Sourcefn identity(&self) -> SharedKeyIdentity
fn identity(&self) -> SharedKeyIdentity
Returns the stable resource and codec compatibility identity.
Sourcefn load(
&self,
context: SharedLoadContext<'_, Self::Value>,
) -> impl Future<Output = Result<Option<Self::Value>, Self::Error>> + Send
fn load( &self, context: SharedLoadContext<'_, Self::Value>, ) -> impl Future<Output = Result<Option<Self::Value>, Self::Error>> + Send
Loads storage, keeping a missing value distinct from a provider failure.
§Errors
Returns the original provider failure.
Sourcefn subscribe(
&self,
context: SharedSubscribeContext,
subscriber: SharedSubscriber<Self::Value>,
) -> Result<Self::Subscription, Self::Error>
fn subscribe( &self, context: SharedSubscribeContext, subscriber: SharedSubscriber<Self::Value>, ) -> Result<Self::Subscription, Self::Error>
Starts owned producer delivery without holding a cache or value lock.
§Errors
Returns the original subscription failure; construction is not published.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".