Sha256: 14a9b1d2c24a9d4ce5d99b50d01147de335ae6393292581014f7905d54ec4949
Contents?: true
Size: 459 Bytes
Versions: 3
Compression:
Stored size: 459 Bytes
Contents
use crate::token::{Id, Span}; use std::cell::Cell; thread_local!(static NEXT: Cell<u32> = Cell::new(0)); pub fn reset() { NEXT.with(|c| c.set(0)); } pub fn generate(span: Span) -> Id<'static> { NEXT.with(|next| { let generation = next.get() + 1; next.set(generation); Id::gensym(span, generation) }) } pub fn fill<'a>(span: Span, slot: &mut Option<Id<'a>>) -> Id<'a> { *slot.get_or_insert_with(|| generate(span)) }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wasmtime-30.0.2 | ./ext/cargo-vendor/wast-226.0.0/src/gensym.rs |
wasmtime-29.0.0 | ./ext/cargo-vendor/wast-224.0.0/src/gensym.rs |
wasmtime-28.0.0 | ./ext/cargo-vendor/wast-223.0.0/src/gensym.rs |