Skip to content

Commit c54137f

Browse files
Rework look-ahead machinery as lazy-evaluated (#1212)
- make `LookAheadValue::List` to contain new iterable `LookAheadList` type - make `LookAheadValue::Object` to contain new iterable `LookAheadObject` type - remove `LookAheadMethods` trait and redundant `ConcreteLookAheadSelection` struct making all APIs accessible as inherent methods on `LookAheadSelection` and `LookAheadChildren` decoupled types - move `LookAheadMethods::child_names()` to `LookAheadChildren::names()` - move `LookAheadMethods::has_children()` to `LookAheadChildren::is_empty()` - move `LookAheadMethods::select_child()` to `LookAheadChildren::select()` - move `LookAheadSelection::for_explicit_type()` to `LookAheadSelection::children_for_explicit_type()` - make `LookAheadSelection::arguments()` returning iterator over `LookAheadArgument` - make `LookAheadSelection::children()` returning `LookAheadChildren` Co-authored-by: Kai Ren <[email protected]>
1 parent e64287c commit c54137f

File tree

12 files changed

+1239
-963
lines changed

12 files changed

+1239
-963
lines changed

book/src/types/interfaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ This requires to explicitly parametrize over [`ScalarValue`][3], as [`Executor`]
391391

392392
```rust
393393
# extern crate juniper;
394-
use juniper::{graphql_interface, graphql_object, Executor, LookAheadMethods as _, ScalarValue};
394+
use juniper::{graphql_interface, graphql_object, Executor, ScalarValue};
395395

396396
#[graphql_interface(for = Human, Scalar = S)] // notice specifying `ScalarValue` as existing type parameter
397397
trait Character<S: ScalarValue> {

juniper/CHANGELOG.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,22 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
5252
- Removed `scalar-naivetime` [Cargo feature].
5353
- Removed lifetime parameter from `ParseError`, `GraphlQLError`, `GraphQLBatchRequest` and `GraphQLRequest`. ([#1081], [#528])
5454
- Upgraded [GraphiQL] to 3.1.0 version (requires new [`graphql-transport-ws` GraphQL over WebSocket Protocol] integration on server, see `juniper_warp/examples/subscription.rs`). ([#1188], [#1193], [#1235])
55-
- Made `LookAheadMethods::children()` method to return slice instead of `Vec`. ([#1200])
5655
- Abstracted `Spanning::start` and `Spanning::end` fields into separate struct `Span`. ([#1207], [#1208])
57-
- Added `Span` to `Arguments` and `LookAheadArguments`. ([#1206], [#1209])
5856
- Removed `graphql-parser-integration` and `graphql-parser` [Cargo feature]s by merging them into `schema-language` [Cargo feature]. ([#1237])
5957
- Renamed `RootNode::as_schema_language()` method as `RootNode::as_sdl()`. ([#1237])
60-
- Renamed `RootNode::as_parser_document()` method as `RootNode::as_document()`. ([#1237])
58+
- Renamed `RootNode::as_parser_document()` method as `RootNode::as_document()`. ([#1237])
59+
- Reworked look-ahead machinery: ([#1212])
60+
- Turned from eagerly-evaluated into lazy-evaluated:
61+
- Made `LookAheadValue::List` to contain new iterable `LookAheadList` type.
62+
- Made `LookAheadValue::Object` to contain new iterable `LookAheadObject` type.
63+
- Removed `LookAheadMethods` trait and redundant `ConcreteLookAheadSelection` type, making all APIs accessible as inherent methods on `LookAheadSelection` and `LookAheadChildren` decoupled types:
64+
- Moved `LookAheadMethods::child_names()` to `LookAheadChildren::names()`.
65+
- Moved `LookAheadMethods::has_children()` to `LookAheadChildren::is_empty()`.
66+
- Moved `LookAheadMethods::select_child()` to `LookAheadChildren::select()`.
67+
- Moved `LookAheadSelection::for_explicit_type()` to `LookAheadSelection::children_for_explicit_type()`.
68+
- Made `LookAheadSelection::arguments()` returning iterator over `LookAheadArgument`.
69+
- Made `LookAheadSelection::children()` returning `LookAheadChildren`.
70+
- Added `Span` to `Arguments` and `LookAheadArguments`. ([#1206], [#1209])
6171

6272
### Added
6373

@@ -145,11 +155,11 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
145155
[#1190]: /../../pull/1190
146156
[#1193]: /../../pull/1193
147157
[#1199]: /../../pull/1199
148-
[#1200]: /../../pull/1200
149158
[#1206]: /../../pull/1206
150159
[#1207]: /../../pull/1207
151160
[#1208]: /../../pull/1208
152161
[#1209]: /../../pull/1209
162+
[#1212]: /../../pull/1212
153163
[#1215]: /../../pull/1215
154164
[#1227]: /../../pull/1227
155165
[#1228]: /../../pull/1228

0 commit comments

Comments
 (0)