pub struct SymbolId(/* private fields */);Expand description
High-performance internal symbol ID
§Properties
- O(1) comparison and hashing
- Generation counter for dangling reference detection
- 8 bytes fixed size
§Important: Always obtain via SymbolRegistry
SymbolId must be obtained through SymbolRegistry::register() or
SymbolRegistry::lookup(). Direct construction is prohibited.
ⓘ
// Correct usage
let id = registry.register(path, kind)?;
let id = registry.lookup(&path)?;
// Prohibited: direct construction
// let id = SymbolId::default(); // Compiles but forbidden§Stability
SymbolId はセッション内でのみ安定。サーバー再起動で値が変わるため、
セッション跨ぎでのキャッシュや永続化には使用不可。
永続的な参照が必要な場合は UUID (MatchResult.uuid) を使用すること。
§Thread Safety
SymbolId is Copy and can be safely shared across threads. However, the SymbolRegistry that owns the symbol data must be properly synchronized.
Implementations§
Trait Implementations§
Source§impl Debug for SymbolId
Debug: wrapped format “SymbolId(165v1)”
impl Debug for SymbolId
Debug: wrapped format “SymbolId(165v1)”
Overrides the default SlotMap KeyData debug output for cleaner logs.
Source§impl<'de> Deserialize<'de> for SymbolId
impl<'de> Deserialize<'de> for SymbolId
Source§fn deserialize<D>(
deserializer: D,
) -> Result<SymbolId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SymbolId, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SymbolId
Display: compact format “165v1”
impl Display for SymbolId
Display: compact format “165v1”
Use this for user-facing output and serialization.
Source§impl Key for SymbolId
impl Key for SymbolId
Source§fn null() -> Self
fn null() -> Self
Creates a new key that is always invalid and distinct from any non-null
key. A null key can only be created through this method (or default
initialization of keys made with
new_key_type!, which calls this
method). Read moreSource§impl Ord for SymbolId
impl Ord for SymbolId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for SymbolId
impl PartialOrd for SymbolId
Source§impl Serialize for SymbolId
impl Serialize for SymbolId
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for SymbolId
impl Eq for SymbolId
impl StructuralPartialEq for SymbolId
Auto Trait Implementations§
impl Freeze for SymbolId
impl RefUnwindSafe for SymbolId
impl Send for SymbolId
impl Sync for SymbolId
impl Unpin for SymbolId
impl UnsafeUnpin for SymbolId
impl UnwindSafe for SymbolId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more