[][src]Derive Macro juniper::GraphQLScalarValue

    // Attributes available to this derive:

This custom derive macro implements the #[derive(GraphQLScalarValue)] derive.

This can be used for two purposes.

Transparent Newtype Wrapper

Sometimes, you want to create a custerm scalar type by wrapping an existing type. In Rust, this is often called the "newtype" pattern. Thanks to this custom derive, this becomes really easy:

// Deriving GraphQLScalar is all that is required.
struct UserId(String);

struct User {
  id: UserId,

The type can also be customized.

/// Doc comments are used for the GraphQL type description.
   // Set a custom GraphQL name.
   name= "MyUserId",
   // A description can also specified in the attribute.
   // This will the doc comment, if one exists.
   description = "...",
struct UserId(String);

Base ScalarValue Enum

TODO: write documentation.