Cynic supports all the built in GraphQL scalars by default. If you want to
query a field of one of these types add a field of the corresponding Rust type
Stringfields in GraphQL should be
Stringfields in Rust.
Intfields in GraphQL should be
Booleanfields in GraphQL map to
IDfields in GraphQL map to the
cynic::Idtype in Rust.
GraphQL allows a schema to define it's own scalars - cynic also supports these.
You can implement the
Scalar trait manually, but it's recommended to use a derive:
#[derive(cynic::Scalar)] struct MyScalar(String);
This defines a scalar called MyScalar - use this in a
QueryFragment where you
want to fetch a field of type
MyScalar (which serializes to a String).
You can change the inner type that's used to serialize & deserialize the scalar by changing the type inside the struct.
Note that this derive only works on newtype structs - for any more complex datatype you'll have to implement cynic::Scalar yourself.