Share immutable data
std.shared.freeze(text) returns an ordinary immutable string that isolates can read without making a separate copy. put and get publish immutable strings under process-wide keys.
Published entries live for the process lifetime. Use it for large read-only data. It does not give workers shared mutable memory.
fn main() {
let text = std.shared.freeze("moon")
println(std.shared.is_shared(text))
std.shared.put("language", text)
println(std.shared.get("language").unwrap())
}
Examples use the moon toolchain version shown beside each result.
Output & diagnostics
Expected: true moon
Ctrl/⌘+Enter runs the current lesson.