Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marianoguerra/erl_interface.rs
Rust wrapper to erl_interface C API
https://github.com/marianoguerra/erl_interface.rs
Last synced: about 1 month ago
JSON representation
Rust wrapper to erl_interface C API
- Host: GitHub
- URL: https://github.com/marianoguerra/erl_interface.rs
- Owner: marianoguerra
- Created: 2015-12-21T22:29:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-06T01:23:42.000Z (almost 9 years ago)
- Last Synced: 2023-04-21T08:16:31.176Z (over 1 year ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
erl_interface.rs
================Attempt at a rust wrapper for `erl_interface `_ C API.
Disclaimer: I have yet to learn rust, this is me writing C in rust syntax until it compiles.
Build
-----::
cargo build
Run
---Change hostname for your hostname (appears on the erlang shell)
::
erl -sname e1 -setcookie secretcookie
cargo run e1@hostname secretcookieIn the erlang sell send something::
(e1@hostname)1> {any, c1@hostname} ! self().
On the rust side you should see something like::
got a send! Pid(e1@hostname, 39, 0, 1)
If you send something like {pid(), any()} it will send you back any(), let's try it.
Start the erlang node as explained above::
erl -sname e1 -setcookie secretcookie
Then start the rust node::
cargo run e1@hostname secretcookie
Running `target/debug/erl_interface e1@hostname secretcookie`
Connected to e1@hostnameFrom the erlang shell send the message with the format explained above::
(e1@hostname)33> {any, c1@hostname} ! {self(), [32, 1.4, foo, {<<"asd">>, "lala"}]}.
{<0.39.0>,[32,1.4,foo,{<<"asd">>,"lala"}]}On the rust node you should see::
got echo! sending List(size: 4, items: (Int(32), Float(1.4), Atom(foo), Tuple(size: 2, items: (Binary(size: 3, items: (97, 115, 100)), List(size: 4, items: (Int(108), Int(97), Int(108), Int(97)))))))
And flushing received messages on the erlang node you should see::
(e1@hostname)34> flush().
Shell got [32,1.4,foo,{<<"asd">>,"lala"}]
ok