4 releases
Uses old Rust 2015
0.1.3 | Aug 14, 2017 |
---|---|
0.1.2 | Aug 14, 2017 |
0.1.1 | Aug 11, 2017 |
0.1.0 | Aug 10, 2017 |
#92 in #idl
735KB
33K
SLoC
C API for graphql-idl-parser
This is an FFI binding to the graphql-idl-parser
crate, which allows you to use
that crate in your C project.
The header file (includes/gql-idl-parser.h
) serves as the primary API documentation of
this library. T
Usage
There are examples on how to use this in C in the example
and test
sub-directories.
Simply running cargo build --release
should generate the .so
or .dylib
for you.
Assuming you have a C compiler, then this should work to run the example:
$ git clone git://github.com/gjtorikian/graphql-idl-parser
$ ./compile
Here's a general usage example:
#include "gql-idl-parser.h"
int main()
{
GraphQLTypes* types = NULL;
size_t types_len = 0;
uint8_t err;
err = gqlidl_parse_schema("# Yeah yeah\nscalar DateTime\ntype OMG {}", &types, &types_len);
if (err > 0) {
printf("Error: Return code %d", err);
exit(err);
}
for (size_t i = 0; i < types_len; i++) {
// ...
}
}
TODO:
- Run Valgrind
Dependencies
~3–4.5MB
~93K SLoC