intern_string

Function intern_string 

Source
pub fn intern_string(s: &str) -> Arc<str>
Expand description

Intern a string using the global string pool

This is the main API for string interning. All string fields in AllocationInfo and related structures should use this function to intern their strings.

ยงExample

use memscope_rs::core::string_pool::intern_string;
use std::sync::Arc;

let s1 = intern_string("hello");
let s2 = intern_string("hello");

// Both Arc<str> point to the same memory
assert!(Arc::ptr_eq(&s1, &s2));