Caller identification in rust like "shared(msg)" equivalent

Hello Dears!

In motoko we can get caller identification using “shared(msg)”, and How to achieve caller identification in rust?

I found it

use ic-cdk::{api};

fn foo() {
    let caller = api::caller();
}
3 Likes