Embedding Rust IDE

Hi,

Rust is relatively new language. A lot of people in my context are using Software with C++ or .NET applications or Python.

Is there any existing project that can help to embed RUST as an editor to 3rd party software that has C++ or .NET opensource backend? So that people could embed RUST into existing software packages?

The wording here is difficult to understand, because Rust is not an editor.

Do you mean you want to write Rust libraries, that can be called by software written in other languages?

1 Like

Sorry for wording. I meant, are there any existing projects that would help to embed Rust into 3rd party software?

Like Python is often embedded for C++ applications for user interface.

Have a look at extism.

1 Like

Rust is not a scripting language like Python, so the answer may be no if that is the sort of embedding you're imagining.

If you want to call Rust code from C++, you write a Rust library. The Rust library will export functions that can be called from C++ using C calling conventions (this is called the C ABI). This is the FFI (foreign function interface) of Rust, and is documented here:

https://doc.rust-lang.org/1.82.0/book/ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code

https://doc.rust-lang.org/nomicon/ffi.html

https://doc.rust-lang.org/1.82.0/reference/linkage.html?highlight=ffi#linkage

1 Like

Thank you the reference. I guess this library does not have any user interface to the languages mentioned?

One would need to write qt or imgui interface completely from scratch?

There is a CLI, but no GUI I'm aware of.

Yes you can embed Rust code in C++ applications, and C++ in Rust applications. See:

C++ is an especially hard case. Interoperability with C is easier. Rust has also nice interop with Python:

Thank you.

When you build pyo3 package do you need any rust installation on other computers or such packages are simply pip installable?

The short version is, unfortunately "it depends": the key word here when installing Python packages is "Wheels" - pre built versions of a package that (when they include native code such as C or Rust) are specific to a platform: for example operating system and CPU architecture.

So "most of the time no, but only if you get it right"

Rust programs don't need an external runtime to run. Compiled programs don't need Rust installed. In this regard Rust is like C or C++, and different from Python, C#, or Java.