uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

`custom_type!()` not support path as a custom type

Open lexoliu opened this issue 7 months ago • 3 comments
trafficstars

I'm trying to define a custom type for a type in my crate

uniffi::custom_type!(crate::Environment, Arc<crate::ffi::Environment>);

However, compiler complain that

rustc: Custom types must only have one component

This problem can be simply triggered by a minimum case:

uniffi::custom_type!(A::B, C);

Custom types must only have one component error would spawn instantly, so seem that it is a limitation from macro...I don't know why the limiation is here...

And there is also a similar case:

// ...

uniffi::custom_type!(Computed<Str>, Arc<ComputedStr>); // not work
rustc: Custom types must only have one component

// ...
type CS=Computed<Str>;
uniffi::custom_type!(CS, Arc<ComputedStr>); // it works

lexoliu avatar Apr 10 '25 18:04 lexoliu