How to mport custom types from candid file in rust?

I know how to import function from other canisters with:

#[import(canister = "some_crate")]
struct SomeCrate

//And call a function with:

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){

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?


All public interfaces defined in corresponding candid file can be accessed through the annotated struct.

#[import(canister_id = "abcde-cai", candid_path = "path/to/some_canister.did")]
struct SomeCanister;

import in ic_cdk_macros - Rust (