-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spanned arguments #1209
Spanned arguments #1209
Conversation
@@ -52,15 +52,15 @@ impl Span { | |||
|
|||
/// Data structure used to wrap items into a [`Span`]. | |||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] | |||
pub struct Spanning<T> { | |||
pub struct Spanning<T, Sp = Span> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added generic argument probably influences how this is documented, but not sure.
The point of the generic is to avoid making a separate type like BorrowedSpanning
, but I'm up for improvement suggestions.
The ability to borrow a Span can lead to slightly more performant code in various places. Currently only in look_ahead
, other future suggestions are e.g. the input validation rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@audunhalland thanks!
Continued from #1206
This change improves diagnostics when performing manual/domain-specific post-validation of arguments using LookAheadArguments. In the case of an error, the produced error message may be able to refer to the exact position in the problematic GraphQL arguments.
On an unrelated note, I noticed
LookAheadArgument
does a deep/greedy transform of theInputValue
to perform variable substitution. A potential improvement to this is to only do this lazily for each expansion step, i.e. the LookAheadArgument privately keeps a reference to itsInputValue
and the variable table and somehow exposes a LookAhead interface on top of this.