I know how to import function from other canisters with:
#[import(canister = "some_crate")]
struct SomeCrate
//And call a function with:
SomeCrate::function_1()
But if that function has a struct as parameter and that struct is defined as a type in candid:
type SomeStruct = record {
"data": text;
};
I don’t know how to import the struct/type, SomeCrate::SomeStruct
doesn’t work.
If I could import the type I could write this:
async fn exec(data: SomeCrate::SomeStruct){
SomeCrate::function_1(data).await
}
But currently I’m have to re write the struct in my rust crate and that is prone to generate bugs on third party canister updates since the compiler wont detect them.
Does the import macro only imports functions or there is a way to import types already implemented?
Thanks