pub trait DbContextResolver {
// Required methods
fn get_owned_context(
&self,
key: impl IDbContextKey + Into<ServiceKey>,
) -> Result<DbContext, RdiError>;
fn get_context(
&self,
key: impl IDbContextKey + Into<ServiceKey>,
) -> Result<Arc<DbContext>, RdiError>;
}Expand description
Typed-context resolution helpers.
Keys are registered through rust-dix’s typed ServiceKey path: enum key
types implementing Into<ServiceKey> (usually via #[derive(DbContextKey)])
register a typed key; &str/String keys keep their String key. The two
forms are not interchangeable, matching rust-dix 0.10+ semantics.
get_context requires a scope (strict scope validation); use
DbContextResolver::get_owned_context for root-safe owned resolution.
Required Methods§
Sourcefn get_owned_context(
&self,
key: impl IDbContextKey + Into<ServiceKey>,
) -> Result<DbContext, RdiError>
fn get_owned_context( &self, key: impl IDbContextKey + Into<ServiceKey>, ) -> Result<DbContext, RdiError>
Resolve an owned DbContext for key (allowed from the root provider).
Sourcefn get_context(
&self,
key: impl IDbContextKey + Into<ServiceKey>,
) -> Result<Arc<DbContext>, RdiError>
fn get_context( &self, key: impl IDbContextKey + Into<ServiceKey>, ) -> Result<Arc<DbContext>, RdiError>
Resolve a shared Arc<DbContext> for key (requires a scope).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".