Skip to content

Rust Language

Make Bazel Work in MacOS for Iceoryx2

In iceoryx2, it uses bazel to build C/C++ bindings. Hence, they want to use bazel for rust for a better unification in iceoryx2.

Currently foreign_cc is used to build the C binding and cc_library to build the C++ bindings. In order to fully exhaust the capabilities of bazel, the C binding and therefore the Rust code should be build with rules_rust.

When I tried it, I found it doesn't work in my MacOS. This blog records some knowledge when I learned bazel and how I solved the problem. It doesn't talk about why we use bazel in a rust project.

Rust Async Brief

As I tried to write a demo by rust wasm, I was thinking about what should be a better signature to export by rust for wasm. In the demo, I exported the process function as a promise:

pub async fn process(input: &[u8]) -> js_sys::Promise

This blog discusses my understanding of async concept in rust and discussion whether returning a promise is a good choice.

Rust Wasm Trail

Recently, I got interested in the WASM as it enables you to write code by rust but run it in the browser. At the first glance, I feel it greatly benefits the case that could be done in the client side, but due to the implementation, it still runs on the server side. It has two big benefits:

  • save server resources
  • implement in a strong type language with many powerful libraries and run it in the browser
  • more portable and convenient

This especially for small tool sites as it usually requires some computation resource, but not many. This blog records my experience to trail the rust wasm for my small tool. It's not a blog about what is wasm and the technical designs/implementations of rust wasm.