Commit 5aa8ed4
committed
Add
I'm running into issues using `schema::Document` with strings. I have a
function that looks roughly like this:
```rust
fn load_schema(filename: String) -> schema::Document<'static, String> {
let schema = std::fs::read_to_string(filename);
graphql_parser::schema::parse_schema<String>(&schema).unwrap()
}
```
However this won't compile, because the generated `Document` has taken a
lifetime from `schema` which doesn't outlive the function.
I was looking around the library and saw that the `query::Document` has an
`into_static` function when using `Strings` which resolves this. This
duplicates that functionality for `schema::Document`.into_static for schema::Document1 parent b0fbd45 commit 5aa8ed4
1 file changed
+20
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
15 | 35 | | |
16 | 36 | | |
17 | 37 | | |
| |||
0 commit comments