Crates.io | inline-vbs |
lib.rs | inline-vbs |
version | 0.4.0 |
source | src |
created_at | 2022-03-01 16:54:22.800501 |
updated_at | 2023-04-29 12:54:32.720706 |
description | Embed VBScript (and JScript, Ruby, Perl, ...) code inside Rust |
homepage | https://github.com/zdimension/inline-vbs |
repository | https://github.com/zdimension/inline-vbs |
max_upload_size | |
id | 541659 |
size | 32,623 |
inline-vbs
is a crate that allows you to embed VBScript, JScript and many other languages inside Rust code files. It uses
the Active Scripting COM APIs to dynamically parse and execute (optionally, evaluate) code.
use inline_vbs::*;
fn main() {
vbs! { On Error Resume Next } // tired of handling errors?
vbs! { MsgBox "Hello, world!" }
let language = "VBScript";
assert_eq!(vbs_!['language & " Rocks!"], "VBScript Rocks!".into());
}
Macros:
vbs!
- Executes a statement or evaluates an expression (depending on context)vbs_!
- Evaluates an expressionvbs_raw!
- Executes a statement (string input instead of tokens, use for multiline code)
See more examples in tests/tests.rs.Add this to your Cargo.toml
:
[dependencies]
inline-vbs = "0.4.0"
Important: You need to have the MSVC Build Tools installed on your computer, as required by cc.
VBScript (vbs!
) and JScript (js!
) are available out of the box on 32-bit and 64-bit.
Other Active Scripting engines exist:
ruby!
): ActiveScriptRuby 1.8 (tested, 32-bit only)
perl!
): ActivePerl 5.20 (32-bit)Note: install an engine matching the bitness of your program; by default Rust on Windows builds
64-bit programs, which can only use 64-bit libraries. If you want to use a 32-bit library, you
need to build your program with --target i686-pc-windows-msvc
.
Many.
N/A
This project is licensed under either of