Expand description
§StaticId
This library provides an extremely memory-efficient implementation of StaticId
for handling interned identifiers with optimal performance.
§Features
StaticId: A highly optimized, interned identifier type combining a code and a venue.- Exceptional memory efficiency: Each
StaticIdis represented by a single 64-bit pointer. - Ultra-fast comparisons: Equality checks and hashing operations only compare 8 bytes, regardless of the actual string length.
- Lazy evaluation: The actual string data is only accessed during serialization.
§Limitations
- The
codecomponent of aStaticIdcannot exceed 32 bytes. - The
venuecomponent of aStaticIdcannot exceed 16 bytes.
§Usage
use static_id::StaticId;
let id = StaticId::from_str("AAPL", "NASDAQ");
assert_eq!(id.get_id().code.as_str(), "AAPL");
assert_eq!(id.get_id().venue.as_str(), "NASDAQ");
// Fast equality check (compares only 8 bytes)
let id2 = StaticId::from_str("AAPL", "NASDAQ");
assert_eq!(id, id2);Re-exports§
pub use symbol::Symbol;