pub trait KeyedUniqueSurface: 'static {
type Key: Clone + Eq + Hash + Debug + Send + Sync + 'static;
type Provider: ?Sized + Send + Sync + 'static;
const KIND: SurfaceKind;
// Provided methods
fn duplicate_error(key: &Self::Key) -> PluginError { ... }
fn key_of(_provider: &Self::Provider) -> Option<Self::Key> { ... }
}Expand description
Keyed-unique family: DashMap<K, Arc<dyn Provider>>.
Distinct from named-unique because the key is not a QName — it
may be a SmolStr scheme/name, an IndexKind, a CrdtKind, etc.
The provider trait often exposes the key (e.g.
crate::traits::collation::CollationProvider::name).
Members: IndexKind, StorageBackend, LabelStorage, Crdt, LogicalType, Collation, Cdc, Catalog.
Required Associated Constants§
Sourceconst KIND: SurfaceKind
const KIND: SurfaceKind
Surface discriminant.
Required Associated Types§
Provided Methods§
Sourcefn duplicate_error(key: &Self::Key) -> PluginError
fn duplicate_error(key: &Self::Key) -> PluginError
Preflight: refuse a duplicate key.
Default implementation returns a generic
PluginError::Internal message; surfaces that need a typed
error (e.g. StorageBackend returns
PluginError::StorageSchemeConflict) override this.
§Errors
Returns a PluginError when the key is already taken.
Sourcefn key_of(_provider: &Self::Provider) -> Option<Self::Key>
fn key_of(_provider: &Self::Provider) -> Option<Self::Key>
Derive the registry key from the provider, when the provider trait self-identifies.
Returns Some(key) for surfaces whose provider exposes its key
directly (e.g. crate::traits::index::IndexKindProvider::kind,
crate::traits::collation::CollationProvider::name). Returns
None for surfaces where the key must be supplied externally
(today only LabelStorageSurface — the label name is not a
property of the crate::traits::storage::Storage trait).
Foundation tasks (§1.1 Phase 4 prerequisites) use this to drive
registration without an outer (key, provider) tuple wherever the
provider already self-identifies.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".