Any possible to invoke rust code in motoko?

How can invoke rust api in motoko, like rust invoke C FFI?

Rust have its own package manger and is mature, a lot of library on it, if motoko can inovke rust api, this will be very good.

I do not want to choose use motoko or rust, just want to use them together.

See “Interact with a service from a Motoko canister” How to :: Internet Computer

But this way costs too much, like providing a web service for you to call it, I just want to static link in the motoko code.

Not at the moment, unfortunately. That would require defining and implementing a Rust/Motoko FFI and new tools for linking them together. Or even a generic platform ABI. Neither is a simple problem.

It’s something I’d like to see in the future, but for now I’m afraid everybody has enough on their plates.

3 Likes

Yes, and another problem is that test on devlopment environment has some problems

  1. Must use agent.fetchRootKey() in development environment but must not in IC mainnet.
  2. Identity delegate not work in development environment, always return sign error mesage.

If you test on IC mainnet, it always need cycle to upgrade canister, cost heavy and not convenience.

You need to run II locally to use in development. Works fine when that is the case

1 Like

OK, let me have a try. Thanks.

After try, everything is ok, thanks a lot.

1 Like