Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/tests/all/store.rs
1692 views
1
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
2
use wasmtime::{Engine, Store};
3
4
#[test]
5
fn into_inner() {
6
static HITS: AtomicUsize = AtomicUsize::new(0);
7
8
struct A;
9
10
impl Drop for A {
11
fn drop(&mut self) {
12
HITS.fetch_add(1, SeqCst);
13
}
14
}
15
16
let engine = Engine::default();
17
assert_eq!(HITS.load(SeqCst), 0);
18
drop(Store::new(&engine, A));
19
assert_eq!(HITS.load(SeqCst), 1);
20
Store::new(&engine, A).into_data();
21
assert_eq!(HITS.load(SeqCst), 2);
22
}
23
24