Updated book for master ***NO_CI***
This commit is contained in:
parent
2b4162f712
commit
f96e8f88aa
4 changed files with 8 additions and 4 deletions
|
@ -535,7 +535,9 @@ struct Person {
|
||||||
<p>If you've got a struct that can't be mapped directly to GraphQL, that contains
|
<p>If you've got a struct that can't be mapped directly to GraphQL, that contains
|
||||||
computed fields or circular structures, you have to use a more powerful tool:
|
computed fields or circular structures, you have to use a more powerful tool:
|
||||||
the <code>object</code> procedural macro. This macro lets you define GraphQL object
|
the <code>object</code> procedural macro. This macro lets you define GraphQL object
|
||||||
fields in a Rust <code>impl</code> block for a type. Continuing with the
|
fields in a Rust <code>impl</code> block for a type. Note that only GraphQL fields
|
||||||
|
can be specified in this <code>impl</code> block. If you want to define normal methods on the struct,
|
||||||
|
you have to do so in a separate, normal <code>impl</code> block. Continuing with the
|
||||||
example from the last chapter, this is how you would define <code>Person</code> using the
|
example from the last chapter, this is how you would define <code>Person</code> using the
|
||||||
macro:</p>
|
macro:</p>
|
||||||
<pre><pre class="playpen"><code class="language-rust">
|
<pre><pre class="playpen"><code class="language-rust">
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -140,7 +140,9 @@
|
||||||
<p>If you've got a struct that can't be mapped directly to GraphQL, that contains
|
<p>If you've got a struct that can't be mapped directly to GraphQL, that contains
|
||||||
computed fields or circular structures, you have to use a more powerful tool:
|
computed fields or circular structures, you have to use a more powerful tool:
|
||||||
the <code>object</code> procedural macro. This macro lets you define GraphQL object
|
the <code>object</code> procedural macro. This macro lets you define GraphQL object
|
||||||
fields in a Rust <code>impl</code> block for a type. Continuing with the
|
fields in a Rust <code>impl</code> block for a type. Note that only GraphQL fields
|
||||||
|
can be specified in this <code>impl</code> block. If you want to define normal methods on the struct,
|
||||||
|
you have to do so in a separate, normal <code>impl</code> block. Continuing with the
|
||||||
example from the last chapter, this is how you would define <code>Person</code> using the
|
example from the last chapter, this is how you would define <code>Person</code> using the
|
||||||
macro:</p>
|
macro:</p>
|
||||||
<pre><pre class="playpen"><code class="language-rust">
|
<pre><pre class="playpen"><code class="language-rust">
|
||||||
|
|
Loading…
Reference in a new issue