eclipse-zenoh / zenoh-c

C API for Zenoh
http://zenoh.io
Other
80 stars 57 forks source link

make rust analyzer's "go to definition" on C loaned, owned, etc. types go to corresponding `decl_c_type!(...)` #785

Open milyin opened 3 weeks ago

milyin commented 3 weeks ago

Describe the feature

Working on zenoh-c it's frequently necessary to know how rust and c-wrapper types are related. For example:

This may be disappointing to anyone who is trying to understand how zenoh-c works. This will slowdown our own performance, making learning curve for zenoh-c internals too steep for new developers and especially for ones who occasionally need to fix something.

The proposal is to declare some internal types in opaque_types instead of the final ones. And declare real API types z_owned_bytes_t, z_loaned_bytes_t, etc. inside decl_c_type! macro. In this case "go to definition" will go directly to this macro call with all necessary information

DenisBiryukov91 commented 3 weeks ago

I think the behavior as is is correct and does not need any change, if needed you can always search for something like "owned(z_owned_bytes_t".

milyin commented 3 weeks ago

I think the behavior as is is correct and does not need any change, if needed you can always search for something like "owned(z_owned_bytes_t".

It's correct but not convenient. When I go to type definition, I want to know how to use this type. The opaque type is completely blind and doesn't give any hints where to find additional information. So this is additional obstacle for ones who want to understand how the API works