You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library I'm working on, has the requirement of being able to be used by rust and non-rust users.
I didn't like the idea of creating a separate crate in the project just as a wrapper for my main library, so I created a proc-macro crate that makes the safe-ffi macros conditional based on a feature flag.
It seems to work well because the file size of the outputs decreases drastically. The ".a" file goes from 26,3 MiB to 25,7 MiB and the ".rlib" file from 641,7 KiB to 51,8 KiB.
This seems like a improvement to me, but it could also be that this would not make any difference to the library users. The Rust compiler could just remove this unneeded code, when it's not used.
Yeah, this is both a legitimate question, and also something a bit "contrived" to be featuring insidesafer-ffi itself (it's basically asking for there to be an opt-out to "disable" the whole crate).
One thing I could do, then, is to basically officialize and publish your safer-ffi-deactivate wrapper crate, since I really see a wrapper crate as the best place to do this kind of conditional replacement with dummy macros.
Sounds like a great idea. I've continued working on my library and realized that methods are not supported. Wrapper functions will be needed for those but I think that, whether or not go for a separate wrapper crate, is a decision that everyone will have to make themselves. So having this separate seems great. Especially because we could maybe add some great helper macros.
The library I'm working on, has the requirement of being able to be used by rust and non-rust users.
I didn't like the idea of creating a separate crate in the project just as a wrapper for my main library, so I created a proc-macro crate that makes the safe-ffi macros conditional based on a feature flag.
It seems to work well because the file size of the outputs decreases drastically. The ".a" file goes from 26,3 MiB to 25,7 MiB and the ".rlib" file from 641,7 KiB to 51,8 KiB.
This seems like a improvement to me, but it could also be that this would not make any difference to the library users. The Rust compiler could just remove this unneeded code, when it's not used.
The text was updated successfully, but these errors were encountered: