How to implement "Actor classes" in rust

In motoko, there is a “Actor classes”, does Rust have a similar approach?

Actor classes enable you to create networks of actors programmatically. Currently, actor classes have to be defined in a separate source file. 
3 Likes

I was also wanted to ask same question, any update?

1 Like

+1, is there a way for rust canister to dynamically create new canisters?

Make update calls create_canister and install_code to management canister

use ic_cdk::export::candid::{encode_args, Principal};
use ic_cdk::api::call::{call, call_with_payment, CallResult};

let management_canister = Principal::management_canister();

# Next is untested code
let req = ...
let cycles = ...
call_with_payment(management_canister, "create_canister", (req,), cycles).await     # will return -> CallResult<()>
call(management_canister, "install_code", (req2,)).await

# Use encode_args for arguments encoding

@wewei Update ^

1 Like