Skip to main content

IDbContextKey

Trait IDbContextKey 

Source
pub trait IDbContextKey: Send + Sync {
    // Required method
    fn name(&self) -> &str;
}
Expand description

Identity of a keyed DbContext.

name() must stay stable for the entity model: it is the string used by #[context("name")] / #[entity(T, "name")].

Prefer #[derive(DbContextKey)], which implements this trait and From<Key> for rust_dix::ServiceKey (typed key for registration, resolution and #[inject(owned, key = Key::Read)]). Manual implementations must also provide that From impl (the official rust-dix extension contract). &str, &String and String are implemented for source compatibility and register as string keys.

Required Methods§

Source

fn name(&self) -> &str

Stable string identity of this key.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IDbContextKey for &String

Source§

fn name(&self) -> &str

Source§

impl IDbContextKey for &str

Source§

fn name(&self) -> &str

Source§

impl IDbContextKey for String

Source§

fn name(&self) -> &str

Implementors§