Coverage Report

Created: 2024-10-16 07:58

/src/wasmer/lib/vm/src/export.rs
Line
Count
Source (jump to first uncovered line)
1
// This file contains code from external sources.
2
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
3
4
use crate::global::VMGlobal;
5
use crate::memory::VMMemory;
6
use crate::store::InternalStoreHandle;
7
use crate::table::VMTable;
8
use crate::vmcontext::VMFunctionKind;
9
use crate::{MaybeInstanceOwned, VMCallerCheckedAnyfunc};
10
use derivative::Derivative;
11
use std::any::Any;
12
use wasmer_types::FunctionType;
13
14
/// The value of an export passed from one instance to another.
15
#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
16
pub enum VMExtern {
17
    /// A function export value.
18
    Function(InternalStoreHandle<VMFunction>),
19
20
    /// A table export value.
21
    Table(InternalStoreHandle<VMTable>),
22
23
    /// A memory export value.
24
    Memory(InternalStoreHandle<VMMemory>),
25
26
    /// A global export value.
27
    Global(InternalStoreHandle<VMGlobal>),
28
}
29
30
0
/// A function export value.
31
0
#[derive(Derivative)]
32
0
#[derivative(Debug)]
33
0
pub struct VMFunction {
34
0
    /// Pointer to the `VMCallerCheckedAnyfunc` which contains data needed to
35
0
    /// call the function and check its signature.
36
0
    #[derivative(Debug = "ignore")]
37
0
    pub anyfunc: MaybeInstanceOwned<VMCallerCheckedAnyfunc>,
38
0
39
0
    /// The function type, used for compatibility checking.
40
0
    pub signature: FunctionType,
41
0
42
0
    /// The function kind (specifies the calling convention for the
43
0
    /// function).
44
0
    pub kind: VMFunctionKind,
45
0
46
0
    /// Associated data owned by a host function.
47
0
    #[derivative(Debug = "ignore")]
48
0
    pub host_data: Box<dyn Any>,
49
0
}
Unexecuted instantiation: <wasmer_vm::export::VMFunction as core::fmt::Debug>::fmt
Unexecuted instantiation: <wasmer_vm::export::VMFunction as core::fmt::Debug>::fmt