Skip to content

Commit a2b2cc3

Browse files
committed
Rename impl_object to object.
1 parent 520cac2 commit a2b2cc3

File tree

40 files changed

+105
-105
lines changed

40 files changed

+105
-105
lines changed

docs/book/content/advanced/introspection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl juniper::Context for Context {}
4444

4545
struct Query;
4646

47-
#[juniper::impl_object(
47+
#[juniper::object(
4848
Context = Context,
4949
)]
5050
impl Query {

docs/book/content/advanced/non_struct_objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enum SignUpResult {
2323
Error(Vec<ValidationError>),
2424
}
2525

26-
#[juniper::impl_object]
26+
#[juniper::object]
2727
impl SignUpResult {
2828
fn user(&self) -> Option<&User> {
2929
match *self {

docs/book/content/advanced/objects_and_generics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct ValidationError {
2525
# #[allow(dead_code)]
2626
struct MutationResult<T>(Result<T, Vec<ValidationError>>);
2727

28-
#[juniper::impl_object(
28+
#[juniper::object(
2929
name = "UserResult",
3030
)]
3131
impl MutationResult<User> {
@@ -38,7 +38,7 @@ impl MutationResult<User> {
3838
}
3939
}
4040

41-
#[juniper::impl_object(
41+
#[juniper::object(
4242
name = "ForumPostResult",
4343
)]
4444
impl MutationResult<ForumPost> {

docs/book/content/quickstart.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ naturally map to GraphQL features, such as `Option<T>`, `Vec<T>`, `Box<T>`,
2020

2121
For more advanced mappings, Juniper provides multiple macros to map your Rust
2222
types to a GraphQL schema. The most important one is the
23-
[impl_object][jp_impl_object] procedural macro that is used for declaring an object with
23+
[object][jp_object] procedural macro that is used for declaring an object with
2424
resolvers, which you will use for the `Query` and `Mutation` roots.
2525

2626
```rust
@@ -60,7 +60,7 @@ struct NewHuman {
6060
}
6161

6262
// Now, we create our root Query and Mutation types with resolvers by using the
63-
// impl_object macro.
63+
// object macro.
6464
// Objects can have contexts that allow accessing shared state like a database
6565
// pool.
6666

@@ -74,7 +74,7 @@ impl juniper::Context for Context {}
7474

7575
struct Query;
7676

77-
#[juniper::impl_object(
77+
#[juniper::object(
7878
// Here we specify the context type for the object.
7979
// We need to do this in every type that
8080
// needs access to the context.
@@ -105,7 +105,7 @@ impl Query {
105105

106106
struct Mutation;
107107

108-
#[juniper::impl_object(
108+
#[juniper::object(
109109
Context = Context,
110110
)]
111111
impl Mutation {
@@ -156,7 +156,7 @@ impl juniper::Context for Ctx {}
156156

157157
struct Query;
158158

159-
#[juniper::impl_object(
159+
#[juniper::object(
160160
Context = Ctx,
161161
)]
162162
impl Query {
@@ -198,4 +198,4 @@ fn main() {
198198
[rocket]: servers/rocket.md
199199
[iron]: servers/iron.md
200200
[tutorial]: ./tutorial.html
201-
[jp_obj_macro]: https://docs.rs/juniper/latest/juniper/macro.impl_object.html
201+
[jp_obj_macro]: https://docs.rs/juniper/latest/juniper/macro.object.html

docs/book/content/schema/schemas_and_mutations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ object somewhere but never references it, it will not be exposed in a schema.
2020
## The query root
2121

2222
The query root is just a GraphQL object. You define it like any other GraphQL
23-
object in Juniper, most commonly using the `impl_object` proc macro:
23+
object in Juniper, most commonly using the `object` proc macro:
2424

2525
```rust
2626
# use juniper::FieldResult;
2727
# #[derive(juniper::GraphQLObject)] struct User { name: String }
2828
struct Root;
2929

30-
#[juniper::impl_object]
30+
#[juniper::object]
3131
impl Root {
3232
fn userWithUsername(username: String) -> FieldResult<Option<User>> {
3333
// Look up user in database...
@@ -48,7 +48,7 @@ usually performs some mutating side-effect, such as updating a database.
4848
# #[derive(juniper::GraphQLObject)] struct User { name: String }
4949
struct Mutations;
5050

51-
#[juniper::impl_object]
51+
#[juniper::object]
5252
impl Mutations {
5353
fn signUpUser(name: String, email: String) -> FieldResult<User> {
5454
// Validate inputs and save user in database...

docs/book/content/servers/iron.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn context_factory(_: &mut Request) -> IronResult<()> {
4747
4848
struct Root;
4949
50-
#[juniper::impl_object]
50+
#[juniper::object]
5151
impl Root {
5252
fn foo() -> String {
5353
"Bar".to_owned()
@@ -99,7 +99,7 @@ fn context_factory(req: &mut Request) -> IronResult<Context> {
9999
100100
struct Root;
101101
102-
#[juniper::impl_object(
102+
#[juniper::object(
103103
Context = Context,
104104
)]
105105
impl Root {

docs/book/content/types/input_objects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct Coordinate {
1414
struct Root;
1515
# #[derive(juniper::GraphQLObject)] struct User { name: String }
1616

17-
#[juniper::impl_object]
17+
#[juniper::object]
1818
impl Root {
1919
fn users_at_location(coordinate: Coordinate, radius: f64) -> Vec<User> {
2020
// Send coordinate to database
@@ -45,7 +45,7 @@ struct WorldCoordinate {
4545
struct Root;
4646
# #[derive(juniper::GraphQLObject)] struct User { name: String }
4747

48-
#[juniper::impl_object]
48+
#[juniper::object]
4949
impl Root {
5050
fn users_at_location(coordinate: WorldCoordinate, radius: f64) -> Vec<User> {
5151
// Send coordinate to database

docs/book/content/types/objects/complex_fields.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you've got a struct that can't be mapped directly to GraphQL, that contains
44
computed fields or circular structures, you have to use a more powerful tool:
5-
the `impl_object` procedural macro. This macro lets you define GraphQL object
5+
the `object` procedural macro. This macro lets you define GraphQL object
66
fields in a Rust `impl` block for a type. Continuing with the
77
example from the last chapter, this is how you would define `Person` using the
88
macro:
@@ -14,7 +14,7 @@ struct Person {
1414
age: i32,
1515
}
1616

17-
#[juniper::impl_object]
17+
#[juniper::object]
1818
impl Person {
1919
fn name(&self) -> &str {
2020
self.name.as_str()
@@ -43,7 +43,7 @@ struct House {
4343
inhabitants: Vec<Person>,
4444
}
4545

46-
#[juniper::impl_object]
46+
#[juniper::object]
4747
impl House {
4848
// Creates the field inhabitantWithName(name), returning a nullable person
4949
fn inhabitant_with_name(&self, name: String) -> Option<&Person> {
@@ -70,7 +70,7 @@ struct Person {
7070
website_url: String,
7171
}
7272

73-
#[juniper::impl_object(
73+
#[juniper::object(
7474
// With this attribtue you can change the public GraphQL name of the type.
7575
name = "PersonObject",
7676
)]
@@ -96,4 +96,4 @@ GraphQL fields expose more features than Rust's standard method syntax gives us:
9696
* Per-argument descriptions
9797

9898
These, and more features, are described more thorougly in [the reference
99-
documentation](https://docs.rs/juniper/latest/juniper/macro.impl_object.html).
99+
documentation](https://docs.rs/juniper/latest/juniper/macro.object.html).

docs/book/content/types/objects/error_handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct Example {
2525
filename: PathBuf,
2626
}
2727

28-
#[juniper::impl_object]
28+
#[juniper::object]
2929
impl Example {
3030
fn contents() -> FieldResult<String> {
3131
let mut file = File::open(&self.filename)?;
@@ -143,7 +143,7 @@ struct Example {
143143
whatever: Option<bool>,
144144
}
145145

146-
#[juniper::impl_object]
146+
#[juniper::object]
147147
impl Example {
148148
fn whatever() -> Result<bool, CustomError> {
149149
if let Some(value) = self.whatever {

docs/book/content/types/objects/using_contexts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct User {
5757

5858

5959
// Assign Database as the context type for User
60-
#[juniper::impl_object(
60+
#[juniper::object(
6161
Context = Database,
6262
)]
6363
impl User {

0 commit comments

Comments
 (0)