[erlang-questions] [ANN] Ruster-Unsafe and Ruster

Daniel Goertzen daniel.goertzen@REDACTED
Wed May 13 16:49:56 CEST 2015


Since Rust is hitting 1.0.0-release shortly, now is a good time to point
out some Rust NIF libraries I’ve been working on.  “Rust” is a modern
systems language with a focus on speed, safety and concurrency.
 “Ruster-Unsafe” is a bare binding of the C NIF API.  “Ruster” is a higher
level binding that sits atop Ruster-Unsafe.

Ruster-Unsafe is usable today, but Ruster is still under heavy
construction.  It is premature for me to be announcing Ruster, but I
thought I would mention it since I'm already talking about Rust and
Ruster-Unsafe.

Ruster-Unsafe
demo: https://github.com/goertzenator/ruster_unsafe_demo
docs: http://goertzenator.github.io/ruster_unsafe/ruster_unsafe/index.html
source: https://github.com/goertzenator/ruster_unsafe

Ruster: https://github.com/goertzenator/ruster
Rust: http://www.rust-lang.org/

A minimal Ruster-Unsafe NIF module looks like …


#[macro_use]
extern crate ruster_unsafe;
use ruster_unsafe::*;

nif_init!(b"ruster_unsafe_minimal\0", None, None, None, None,
    nif!(b"just123\0", 0, just123)
);

extern "C" fn just123(_env: *mut ErlNifEnv, _argc: c_int,
    _args: *const ERL_NIF_TERM) -> ERL_NIF_TERM {
unsafe { enif_make_int(env, 123) }
}



Example of the sort of thing I’m aiming for with Ruster ...

// crack the tuple {1, 2, {3, 4}}
let (a,b,(c,d)) = try!(from_term::<(u32,u32,(u32, u32))>(env, term));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150513/025f5e87/attachment.htm>


More information about the erlang-questions mailing list