| Crates.io | cklein |
| lib.rs | cklein |
| version | 0.1.0 |
| created_at | 2025-01-21 17:39:23.81754+00 |
| updated_at | 2025-01-21 17:39:23.81754+00 |
| description | High-level safe bindings to the Klein scripting language. |
| homepage | |
| repository | https://github.com/klein-language/klein/tree/main/bindings/rust |
| max_upload_size | |
| id | 1525133 |
| size | 238,554 |
ckleinRust bindings to the Klein scripting language.
Add cklein to your project:
cargo add cklein
It can be used to run, tokenize, and parse Klein code; For example:
fn main() -> Result<(), cklein::RuntimeError> {
cklein::run!(r#"
for number in 1.to(100) {
if number.mod(3) == 0 and number.mod(5) == 0 {
print("FizzBuzz");
} else if number.mod(3) == 0 {
print("Fizz");
} else if number.mod(5) == 0 {
print("Buzz");
} else {
print(number);
}
}
"#)
}
Bindings are automatically generated via bindgen from the klein.h header file; See the build file for more details.