1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* MetaCall Library by Parra Studios
* A library for providing a foreign function interface calls.
*
* Copyright (C) 2016 - 2026 Vicente Eduardo Ferrer Garcia <vic798@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
//! [METACALL](https://github.com/metacall/core) is a library that allows calling functions,
//! methods or procedures between programming languages. With METACALL you can transparently
//! execute code from / to any programming language, for example, call TypeScript code from Rust.
//! Click [here](https://github.com/metacall/install) for installation guide.
//!
//! General usage example:
//! Let's consider we have the following Typescript code:
//! `sum.ts`
//! ``` javascript
//! export function sum(a: number, b: number): number {
//! return a + b;
//! }
//! ```
//! Now let's jump into Rust:
//!
//! ```
//! use metacall::{initialize, metacall, load};
//!
//! fn main() {
//! // Initialize MetaCall at the top
//! let _metacall = initialize().unwrap();
//!
//! // Load the file (Checkout the loaders module for loading multiple files
//! // or loading from string)
//! load::from_single_file(load::Tag::TypeScript, "sum.ts").unwrap();
//!
//! // Call the sum function (Also checkout other metacall functions)
//! let sum = metacall::<f64>("sum", [1.0, 2.0]).unwrap();
//!
//! assert_eq!(sum, 3.0);
//! }
//!
//! ```
pub
pub
pub use *;
/// Contains MetaCall loaders from file and memory. Usage example: ...
/// ```
/// // Loading a single file with Nodejs.
/// metacall::load::from_single_file(metacall::load::Tag::NodeJS, "index.js").unwrap();
///
/// // Loading multiple files with Nodejs.
/// metacall::load::from_file(metacall::load::Tag::NodeJS, ["index.js", "main.js"]).unwrap();
///
/// // Loading a string with Nodejs.
/// let script = "function greet() { return 'hi there!' }; module.exports = { greet };";
/// metacall::load::from_memory(metacall::load::Tag::NodeJS, script, None).unwrap();
/// ```
pub use *;
pub use metacall_box;
pub use initialize;
pub use is_initialized;
pub use *;
/// Contains MetaCall language inliners. Usage example: ...
/// ```
/// // Python
/// py! {
/// print("hello world")
/// }
///
/// // Nodejs
/// node! {
/// console.log("hello world");
/// }
///
/// // Typescript
/// ts! {
/// console.log("hello world");
/// }
/// ```