Closed calder closed 5 months ago
I was about to open another PR with exactly the same change. I think this extremely useful, if the Source
type already owns a copy of the original source code, it would be great if I can access it from my application.
Thanks for the PR, sorry it took me so long to get round to this.
I'll merge this for now, although I'm somewhat worried about the implications of restricting Source
to a contiguous UTF-8 representation internally. I'd rather not make promises about this continuing to exist into the future.
Use Case
Please correct if there's a less dumb way of doing this!
I'm using a custom
Cache
implementation, and would like to maintain a singleId
-->Source
map. This doesn't work today because there's no way for non-Ariadne consumers like a parser to accessSource::text
. Exposing it makesSource
immediately useful for non-Ariadne applications.