ABI-compatable types and functions are all prefixed with `GHOST_` and are exported in the `c` module (TODO).
ABI-compatable types and functions are all prefixed with ~GHOST_~ and are exported in the ~c~ module.
I've attempted to provide more Rust-idiomatic API variants as well, which have non-prefixed names.
Rust-native API variants are made as well, which have non-prefixed names.
** Notes
** Notes
Eventually I intend to have /most/ (if not all) C compatable types either reimplemented or aliased to non-prefixed Rust types.
Eventually we should intend to have /most/ (if not all) C compatable types either reimplemented or aliased to non-prefixed Rust types.
At present though this is not the case, and prefixed names that can double as ergonomic Rust types are not aliased to them, so you'll have to use both often.
At present though this is not the case, and prefixed names that can double as ergonomic Rust types are not aliased to them, so you'll have to use both often.
The reimplementation is undergoing, the aliasing not yet.
The reimplementation is undergoing, the aliasing not yet.
I've elected to leave out implementing ~Copy~ for /most/ FFI types, because I think the ownership model will work well here.
Leaving out implementing ~Copy~ for /most/ FFI types was a design decision, because I think the ownership model will work well here. (The hack flags-like structures need to implement copy to avoid passing around useless references when assigning them.)
This may be changed in the future, as (virtually) all implement ~Clone~ anyway.
This may be changed in the future, as (virtually) all implement ~Clone~ anyway.
I did this basically just because I want people to think about it when and why they copy something, instead of it being default behaviour.
I did this basically just because I want people to think about it when and why they copy something, instead of it being default behaviour. If it proves inconvenient it can be changed.
** Implementation
** Implementation
*** Implemented C compatable ABI
*** Implemented C compatable ABI
Note: List is in-progress and doesn't show everything
Note: List is in-progress and doesn't show everything. (Also the checkboxes might not be rendered here.)
- [-] `GHOST_Types.h`
- [-] `GHOST_Types.h`
- [X]/Handles/
- [X]/Handles/
@ -58,11 +58,12 @@
- [X] GHOST_DialogOptions
- [X] GHOST_DialogOptions
- [X] GHOST_TabletData
- [X] GHOST_TabletData
- [X]/Constants/
- [X]/Constants/
- [X]=GHOST_TABLET_DATA_NONE= (reimpl as ~const fn GHOST_TabletData::none()~)
- [X]=GHOST_TABLET_DATA_NONE= (reimpl. as ~const fn GHOST_TabletData::none()~)
*** Native Rust API
*** Native Rust API
I provide more Rust idiomatic API for some things.
Rust native APIs are provided for things where the C API bindings are cumbersome or unsafe.
They may or may not share ABI, if they do they will have type aliases to the corresponding ~GHOST_~ identifier, so always use those when ABI compatability is desired.
They may or may not share ABI, if they do they will have type aliases to the corresponding ~GHOST_~ identifier, so always use those when ABI compatability is desired.
Currently, most of the intended Rust API and structures do not exist (I haven't really studied the codebase), and C ones that are suitable for this purpose are mostly not aliased yet.
**** Overview
**** Overview
List and implementation status of features
List and implementation status of features
@ -72,6 +73,9 @@
- [X] [[Error handling]]: ~error.rs~
- [X] [[Error handling]]: ~error.rs~
- [ ] Events: ~event.rs~
- [ ] Events: ~event.rs~
***** Aliases
- [X]/Handle types/
**** Handles
**** Handles
Handles keep the C ABI, but are re-wrtten with traits to be more idiomatic.
Handles keep the C ABI, but are re-wrtten with traits to be more idiomatic.