FFI - Python and Node.js and Rust

Published: 23 July 2021
on channel: krscleancode
310
1

We demonstrate a couple of design ideas to embed Rust with Python and Node.js and to dynamically invoke the foreign function

We introduce cdylib, the c-compatible dynamic library format of Rust.

We start by performing certain interesting experiments with Strings and String slices to understand the challenges in exchanging the pointers between Rust and Python.

Then we introduce the significance of CString and CStr, the c-styled null-terminated implementation of Rust, that makes the invocation safe and breeze.

We continue our discussion on exposing the Rust Struct to the Python Client using the "principle of least knowledge". This type of adapter pattern finds a lot of applications in the field of interoperability between two languages. This design style is the first step towards understanding WebAssembly

Then we switch our experiment with Node.js and Rust interoperation, to appreciate the commonality with the earlier Python adapter implementation.

Yes, we continue our pursuit of cross-compiling the PatternCounter, in its cdylib shared object format, for the Linux Target.

Finally, we complete our experiment with the joy of invoking the foreign function from Node.js in the Linux environment


On this page of the site you can watch the video online FFI - Python and Node.js and Rust with a duration of hours minute second in good quality, which was uploaded by the user krscleancode 23 July 2021, share the link with friends and acquaintances, this video has already been watched 310 times on youtube and it was liked by 1 viewers. Enjoy your viewing!