As mentioned in https://github.com/graphql-rust/juniper/pull/1209#discussion_r1388107123, making Spanning generic over Sp allows avoiding copying 6 usizes (the Span) in places where a borrowed Spanning needs to be type mapped. I.e. the Document contains Spanning<InputValue>, but InputValue is an enum, so when the spanned item's type gets mapped into a reference to each variant, there's no need to transform &Spanning<T, Span> to Spanning<&U, Span>. It can instead be transformed to a Spanning<&U, &Span>.
This applies to the Visitor trait and its methods related to the visitation of InputValues. The Visitor trait is public, but #[doc(hidden)].
As mentioned in https://github.com/graphql-rust/juniper/pull/1209#discussion_r1388107123, making
Spanning
generic overSp
allows avoiding copying 6usize
s (theSpan
) in places where a borrowed Spanning needs to be type mapped. I.e. theDocument
containsSpanning<InputValue>
, butInputValue
is an enum, so when the spanned item's type gets mapped into a reference to each variant, there's no need to transform&Spanning<T, Span>
toSpanning<&U, Span>
. It can instead be transformed to aSpanning<&U, &Span>
.This applies to the
Visitor
trait and its methods related to the visitation ofInputValue
s. TheVisitor
trait is public, but#[doc(hidden)]
.