1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate*;
use ;
/// Transforms a `syn::LitStr` representing a path (e.g.
/// `"std::collections::HashMap"`) into an actual instance of `syn::Path` that
/// can be then fed into the `quote!` macro.
///
/// # Abstract
///
/// While working with attributes, we internally rely on `syn::Meta` which
/// supports maps with literal values only; for instance, it understands
/// `#[foo(bar = "somewhere::SomeStruct")]`, but fails on
/// `#[foo(bar = somewhere::SomeStruct)]` (or at least returns data in a
/// somewhat inconvenient format).
///
/// On the other hand, we can't use `syn::LitStr` inside `quote!` in a type
/// position (e.g. `quote! { type x = #str }`), because `quote!` always
/// automatically escapes all strings (e.g. into
/// `type x = "somewhere::SomeString"`).
///
/// Thus this function is responsible for transforming `syn::LitStr` into a
/// `syn::Path` it should've been from the beginning.