Macro coord

Source
macro_rules! coord {
    ( @ $name:ident ) => { ... };
    ( @ $name:ident ( $arg:ident : ) ) => { ... };
    ( $name:ident ) => { ... };
    ( $name:ident . $attribute:ident ) => { ... };
    ( $name:ident . $field:ident ( $arg:ident : ) ) => { ... };
}
Expand description

Create a DirectiveCoordinate, DirectiveArgumentCoordinate, TypeCoordinate, TypeAttributeCoordinate, or FieldArgumentCoordinate at compile time.

use apollo_compiler::coord;

assert_eq!(coord!(@directive).to_string(), "@directive");
assert_eq!(coord!(@directive(arg:)).to_string(), "@directive(arg:)");
assert_eq!(coord!(Type).to_string(), "Type");
assert_eq!(coord!(Type.field).to_string(), "Type.field");
assert_eq!(coord!(Type.field(arg:)).to_string(), "Type.field(arg:)");
assert_eq!(coord!(EnumType.ENUM_VALUE).to_string(), "EnumType.ENUM_VALUE");

All possible return types of this macro implement From<SchemaCoordinate> so they can be converted using .into():

use apollo_compiler::coord;
use apollo_compiler::coordinate::SchemaCoordinate;

let _: SchemaCoordinate = coord!(Query).into();