mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
798 stars 44 forks source link

Allow to put the unsafe keyword within the cpp! macro #40

Closed ogoffart closed 6 years ago

ogoffart commented 6 years ago

Having to put an unsafe keyword around the cpp! closure mean also adding a level of {} nesting which is annoying for the readability. So this allow to put the unsafe keyword directly within the macro without forcing another level of nesting.

ogoffart commented 6 years ago

I find this quite inconvenient to always add a level of nesting because of the unsafe block, so writing cpp!(unsafe [] -> u32 as "int" { return 42; }) with the unsafe keyword within the macro helps to avoid mistakes with the level of } and ) and the amount of nesting.

@mystor what do you think?