| 700 | |
| 701 | #[test] |
| 702 | fn store_with_context() -> Result<()> { |
| 703 | struct Ctx { |
| 704 | called: bool, |
| 705 | } |
| 706 | |
| 707 | let engine = Engine::default(); |
| 708 | let mut linker = Linker::new(&engine); |
| 709 | |
| 710 | linker.func_wrap("", "", |mut caller: Caller<'_, Ctx>| { |
| 711 | caller.data_mut().called = true; |
| 712 | })?; |
| 713 | |
| 714 | let mut store = Store::new(&engine, Ctx { called: false }); |
| 715 | |
| 716 | let f = linker.get(&mut store, "", "").unwrap().into_func().unwrap(); |
| 717 | f.call(&mut store, &[], &mut [])?; |
| 718 | |
| 719 | assert!(store.data().called); |
| 720 | |
| 721 | Ok(()) |
| 722 | } |
| 723 | |
| 724 | #[test] |
| 725 | #[cfg_attr(miri, ignore)] |