cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

Emit `_Nullable` alongside `_Nonnull`

Open dcow opened this issue 4 years ago • 1 comments

I was playing with adding _Nonnull annotations to an FFI that I consume in Swift. If you configure cbindgen to emit _Nonnull and run the header through xcodebuild, much like giving a mouse a cookie, Xcode will ask for more. Xcode complains that all the other pointers don't have explicit _Nullable annotations. It would be nice if you could configure nullable_attribute and have cbindgen emit it whenever it encounters an Optional<&T>, Optional<&mut T>, *const T, or *mut T.

dcow avatar Aug 31 '21 08:08 dcow

Patch welcome :)

emilio avatar Apr 15 '24 01:04 emilio