git push CI
npm install tons-of-packages
💰
RAM
CPU
💰
Slide 29
Slide 29 text
Embedding Node.js
in orogene
Slide 30
Slide 30 text
• Run JavaScript without "shelling out“
• Shim module loading (and resolution)
logic
Slide 31
Slide 31 text
• Run JavaScript without "shelling out“
• Shim module loading (and resolution)
logic
🤔
🤔
Content-
addressable
cache?
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
Node.js has an embedder API
Slide 35
Slide 35 text
Node.js has an embedder API
...but in C++
Slide 36
Slide 36 text
FFI
Foreign
Function
Interface
Slide 37
Slide 37 text
FFI
Slide 38
Slide 38 text
FFI
Only for C!
Slide 39
Slide 39 text
Fortunately,
• Node.js can be compiled as a library
• Node.js embedder API example has an extremely
simple call signature
• It is easy to export C functions from C++
Slide 40
Slide 40 text
for rustc
Building Node.js
Slide 41
Slide 41 text
No content
Slide 42
Slide 42 text
Simple call signature
= Easy C wrapper
Slide 43
Slide 43 text
Inside C++ code
Slide 44
Slide 44 text
Inside Rust code
Slide 45
Slide 45 text
Inside Rust code
C-style string
Slide 46
Slide 46 text
Rust build.rs script
Slide 47
Slide 47 text
Rust build.rs script
libnode.so.83
Slide 48
Slide 48 text
Use the C wrapper from Rust
Slide 49
Slide 49 text
Use the C wrapper from Rust
Slide 50
Slide 50 text
No content
Slide 51
Slide 51 text
No content
Slide 52
Slide 52 text
No content
Slide 53
Slide 53 text
No content
Slide 54
Slide 54 text
and type checker…?
Slide 55
Slide 55 text
https://github.com/jlkiri/nodeinrust
Slide 56
Slide 56 text
Special Thanks
Kat Marchán
Felipe Seré
Anna Henningsen
and many others!