grayjack / janetrs Goto Github PK
View Code? Open in Web Editor NEWRust high level bindings for Janet
License: MIT License
Rust high level bindings for Janet
License: MIT License
I've noticed that for non-Copy
types, the passed value to JanetAbstract::new
gets dropped immediately when the mutable pointer it gets moved into goes out of scope. This isn't ideal obviously, so I've been wrapping the types in ManuallyDrop
and then using ManuallyDrop::drop
in the gc handler. This seems like something the API should handle for you, or at least something added to the documentation.
In janetrs-dev/src/types/array.rs, maybe in code, " if index < 0 || index > self.len() + 1" should be " if index < 0 || index > self.len()" ?
/// # Janet Panics
/// Janet panics if `index < 0` or `index > len`.
///
/// # Examples
/// ```
/// use janetrs::array;
/// # let _client = janetrs::client::JanetClient::init().unwrap();
///
/// let mut array = array![1, 2];
/// array.insert(1, 3) // now it's `[1, 3, 2]`
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn insert(&mut self, index: i32, element: impl Into<Janet>) {
if index < 0 || index > self.len() + 1 {
crate::jpanic!(
"insertion index (is {}) should be >= 0 and <= {})",
index,
self.len()
);
I'm trying to create a demo:
use janetrs::client::{Error, JanetClient};
fn main() -> Result<(), Error> {
let client = JanetClient::init_with_default_env()?;
client.run("(print `Hello from Janet!`)")?;
let out = client.run("(+ 2 2)")?;
println!("{}", out);
Ok(())
}
I don't modify the feature flags of janet.
When I try to compile, I run into this:
Compiling janetrs v0.5.0
error[E0425]: cannot find value `JANET_FILE_PIPED` in crate `evil_janet`
--> /home/lyh/.cargo/registry/src/github.com-1ecc6299db9ec823/janetrs-0.5.0/src/types/io.rs:319:46
|
319 | pub const PIPED: Self = Self(evil_janet::JANET_FILE_PIPED as i32);
| ^^^^^^^^^^^^^^^^ help: a constant with a similar name exists: `JANET_FILE_APPEND`
|
::: /home/lyh/Test/hello_jrs/target/debug/build/evil-janet-3c3a63e12ae3fb5f/out/bindings.rs:94:1
|
94 | pub const JANET_FILE_APPEND: u32 = 4;
| -------------------------------- similarly named constant `JANET_FILE_APPEND` defined here
For more information about this error, try `rustc --explain E0425`.
error: could not compile `janetrs` due to previous error
How can I fix this? Thank you!
The TryFrom<Janet>
implementation for i64
and u64
only tries to get value from the Janet value if the it is an abstract type.
While the internal Janet implementation can get if the Janet value is a number (f64/double), a JanetString or Janet Abstract
Hi,
I just added janetrs to a simple hello Cargo.toml project on Windows and I'm having difficulty building it. cargo build
fails to build evil-janet. What are the installation steps for building on Windows?
Currently I'm getting the following error:
--- stderr
Compiling evil-janet v1.33.0
error: failed to run custom build command for `evil-janet v1.33.0`
Caused by:
process didn't exit successfully: `C:\RustProjects\tryjanet\target\debug\build\evil-janet-263d1522556b4cd8\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=csrc/janet.h
--- stderr
./csrc/janet.h:435:10: fatal error: 'stdlib.h' file not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.