PubSub Rust - Returning Functions from Actors

I’m struggling to figure out how to pass around a canister actor method reference in Rust like we can with Motoko.

I was pointed towards the Candid type reference which showed I should be using the IDLValue, but the type isn’t implemented and can’t be serialized on its own.

I feel like I’m missing something small.

Can anyone get me back on track?

1 Like

I got this to work with candid::Func

use ic_cdk::export::candid::Func;

let fn = Func {
    principal: Principal::from_text("r7inp-6aaaa-aaaaa-aaabq-cai").unwrap(),
    method: String::from("funcname"),
}

How do I get the canister’s own principal?