pub struct RecordKey(/* private fields */);Expand description
Stable identifier for a record
Supports both static (zero-cost) and dynamic (Arc-allocated) names.
Use string literals for the common case; they auto-convert via From.
§Naming Convention
Recommended format: <namespace>.<category>.<instance>
Examples:
sensors.temperature.outdoorsensors.temperature.indoormesh.weather.sf-bayconfig.app.settingstenant.acme.sensors.temp
§Examples
use aimdb_core::record_id::RecordKey;
// Static (preferred) - zero allocation
let key: RecordKey = "sensors.temperature".into();
// Dynamic - for runtime-generated names
let key = RecordKey::dynamic(format!("tenant.{}.sensors", "acme"));Implementations§
Source§impl RecordKey
impl RecordKey
Sourcepub const fn new(s: &'static str) -> Self
pub const fn new(s: &'static str) -> Self
Create from a static string literal
This is a const fn, usable in const contexts.
Sourcepub fn dynamic(s: impl Into<Arc<str>>) -> Self
pub fn dynamic(s: impl Into<Arc<str>>) -> Self
Create from a runtime-generated string
Use this for dynamic names (multi-tenant, config-driven, etc.).
Sourcepub fn from_dynamic(s: &str) -> Self
pub fn from_dynamic(s: &str) -> Self
Create from a runtime string (alias for dynamic)
Allocates an Arc<str> to store the string.
Trait Implementations§
Source§impl Borrow<str> for RecordKey
Enable O(1) HashMap lookup by &str
impl Borrow<str> for RecordKey
Enable O(1) HashMap lookup by &str
This allows hashmap.get("string_literal") without allocating a RecordKey.
Source§impl<'de> Deserialize<'de> for RecordKey
Available on crate feature std only.
impl<'de> Deserialize<'de> for RecordKey
Available on crate feature
std only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<String> for RecordKey
Available on crate feature std only.Ergonomic conversion from owned String (std)
impl From<String> for RecordKey
Available on crate feature
std only.Ergonomic conversion from owned String (std)
Source§impl Ord for RecordKey
impl Ord for RecordKey
Source§impl PartialOrd for RecordKey
impl PartialOrd for RecordKey
impl Eq for RecordKey
Auto Trait Implementations§
impl Freeze for RecordKey
impl RefUnwindSafe for RecordKey
impl Send for RecordKey
impl Sync for RecordKey
impl Unpin for RecordKey
impl UnwindSafe for RecordKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more