Sha256: 7d54310d5318967bbb3eecfeec3a36f2a58903e98d0b22d9b934cd26eca8822a

Contents?: true

Size: 703 Bytes

Versions: 10

Compression:

Stored size: 703 Bytes

Contents

//! Unique IDs for modules in the runtime.

use core::num::NonZeroU64;

/// A unique identifier (within an engine or similar) for a compiled
/// module.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CompiledModuleId(NonZeroU64);

impl CompiledModuleId {
    /// Allocates a new ID which will be unique within this process.
    pub fn new() -> Self {
        // As an implementation detail this is implemented on the same
        // allocator as stores. It's ok if there are "holes" in the store id
        // space as it's not required to be compact, it's just used for
        // uniqueness.
        CompiledModuleId(crate::store::StoreId::allocate().as_raw())
    }
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
wasmtime-30.0.2 ./ext/cargo-vendor/wasmtime-30.0.2/src/runtime/vm/module_id.rs
wasmtime-29.0.0 ./ext/cargo-vendor/wasmtime-29.0.0/src/runtime/vm/module_id.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmtime-28.0.0/src/runtime/vm/module_id.rs
wasmtime-27.0.0 ./ext/cargo-vendor/wasmtime-27.0.0/src/runtime/vm/module_id.rs
wasmtime-26.0.0 ./ext/cargo-vendor/wasmtime-26.0.0/src/runtime/vm/module_id.rs
wasmtime-25.0.2 ./ext/cargo-vendor/wasmtime-25.0.2/src/runtime/vm/module_id.rs
wasmtime-25.0.1 ./ext/cargo-vendor/wasmtime-25.0.1/src/runtime/vm/module_id.rs
wasmtime-25.0.0 ./ext/cargo-vendor/wasmtime-25.0.0/src/runtime/vm/module_id.rs
wasmtime-24.0.0 ./ext/cargo-vendor/wasmtime-24.0.0/src/runtime/vm/module_id.rs
wasmtime-23.0.2 ./ext/cargo-vendor/wasmtime-23.0.2/src/runtime/vm/module_id.rs