FFI - Python and Node.js and Rust

Pubblicato il: 23 luglio 2021
sul canale di: 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


In questa pagina del sito puoi guardare il video online FFI - Python and Node.js and Rust della durata di ore minuti seconda in buona qualità , che l'utente ha caricato krscleancode 23 luglio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 310 volte e gli è piaciuto 1 spettatori. Buona visione!