https://github.com/emoon/apigen
Basic API/data description lang + parser that can be used for generating API/data interfaces, etc
https://github.com/emoon/apigen
Last synced: about 1 year ago
JSON representation
Basic API/data description lang + parser that can be used for generating API/data interfaces, etc
- Host: GitHub
- URL: https://github.com/emoon/apigen
- Owner: emoon
- License: mit
- Created: 2022-04-03T06:35:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-28T11:57:18.000Z (about 4 years ago)
- Last Synced: 2025-01-28T02:32:04.722Z (over 1 year ago)
- Language: Rust
- Size: 49.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/emoon/apigen/actions?workflow=Rust)
# apigen
Basic API/data description lang + parser that can be used for generating API/data interfaces, etc
It allows you to have structs like this
```Rust
struct ImageInfo {
/// width of the image
width: u32,
/// height of the Image
height: u32,
}
#[attributes(Handle, Drop)]
struct Image {
/// Comments here
[static] create_from_file(filename: String) -> Image?,
/// More comments
[static] create_from_memory(name: String, data: [u8]) -> Image?,
/// Get data amout the image
[static] get_info(image: Image) -> *const ImageInfo?,
/// Destroy the created image
destroy(),
}
```
And it gets parsed into data structures. It's then up to the user to decide how to to write this data out. Some convinince functionally for C and Rust is provided as that is the primary target of this. The full grammar for this can be found here https://github.com/emoon/apigen/blob/main/src/api.pest