Skip to main content

wasmedge_sdk/
utils.rs

1//! Defines WasmEdge Driver and CoreVersion types
2use wasmedge_sys::utils;
3
4/// Defines WasmEdge Driver functions
5#[derive(Debug)]
6pub struct Driver {}
7impl Driver {
8    /// Triggers the WasmEdge AOT compiler tool
9    pub fn aot_compiler<I, V>(args: I) -> i32
10    where
11        I: IntoIterator<Item = V>,
12        V: AsRef<str>,
13    {
14        utils::driver_aot_compiler(args)
15    }
16
17    /// Triggers the WasmEdge runtime tool
18    pub fn runtime_tool<I, V>(args: I) -> i32
19    where
20        I: IntoIterator<Item = V>,
21        V: AsRef<str>,
22    {
23        utils::driver_runtime_tool(args)
24    }
25
26    /// Triggers the WasmEdge unified tool
27    pub fn unified_tool<I, V>(args: I) -> i32
28    where
29        I: IntoIterator<Item = V>,
30        V: AsRef<str>,
31    {
32        utils::driver_unified_tool(args)
33    }
34}
35
36/// The version info of WasmEdge core
37pub struct CoreVersion {}
38impl CoreVersion {
39    /// Returns the major version value of WasmEdge core.
40    pub fn major() -> u32 {
41        wasmedge_sys::utils::version_major_value()
42    }
43
44    /// Returns the minor version value of WasmEdge core.
45    pub fn minor() -> u32 {
46        wasmedge_sys::utils::version_minor_value()
47    }
48
49    /// Returns the patch version value of WasmEdge core.
50    pub fn patch() -> u32 {
51        wasmedge_sys::utils::version_patch_value()
52    }
53
54    /// Returns the version string of WasmEdge core.
55    pub fn version_string() -> String {
56        wasmedge_sys::utils::version_string()
57    }
58}