Debian Codegraph @

src/common/path.rs

raw symbols SCIP
1 use quoterust-analyzer cargo quote 1.0.47 crate/::ToTokensrust-analyzer cargo quote 1.0.47 to_tokens/ToTokens#;
2 use synrust-analyzer cargo syn 2.0.119 crate/::{spannedrust-analyzer cargo syn 2.0.119 spanned/::Spannedrust-analyzer cargo syn 2.0.119 spanned/Spanned#, Exprrust-analyzer cargo syn 2.0.119 expr/Expr#, Litrust-analyzer cargo syn 2.0.119 lit/Lit#, LitStrrust-analyzer cargo syn 2.0.119 lit/LitStr#, Metarust-analyzer cargo syn 2.0.119 attr/Meta#, MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#, Pathrust-analyzer cargo syn 2.0.119 path/Path#};
3
4 #[inline]
5 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_name_value_2_pathrust-analyzer cargo educe 0.6.0 common/path/meta_name_value_2_path().(name_value: &MetaNameValuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<Pathrust-analyzer cargo syn 2.0.119 path/Path#> {
6 match &name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value. {
7 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Litrust-analyzer cargo syn 2.0.119 expr/Expr#Lit#(lit) => {
8 if let Litrust-analyzer cargo syn 2.0.119 lit/Lit#::Strrust-analyzer cargo syn 2.0.119 lit/Lit#Str#(lit) = &lit.litrust-analyzer cargo syn 2.0.119 expr/ExprLit#lit. {
9 return lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().();
10 }
11 },
12 Exprrust-analyzer cargo syn 2.0.119 expr/Expr#::Pathrust-analyzer cargo syn 2.0.119 expr/Expr#Path#(path) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(path.pathrust-analyzer cargo syn 2.0.119 expr/ExprPath#path..clonerust-analyzer cargo syn 2.0.119 gen/clone/impl#[`crate::Path`][Clone]clone().()),
13 _ => (),
14 }
15
16 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
17 name_value.valuerust-analyzer cargo syn 2.0.119 attr/MetaNameValue#value..spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
18 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = Path`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(&name_value.pathrust-analyzer cargo syn 2.0.119 attr/MetaNameValue#path.)),
19 ))
20 }
21
22 #[inline]
23 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn meta_2_pathrust-analyzer cargo educe 0.6.0 common/path/meta_2_path().(meta: &Metarust-analyzer cargo syn 2.0.119 attr/Meta#) -> synrust-analyzer cargo syn 2.0.119 crate/::Resultrust-analyzer cargo syn 2.0.119 error/Result#<Pathrust-analyzer cargo syn 2.0.119 path/Path#> {
24 match &meta {
25 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::NameValuerust-analyzer cargo syn 2.0.119 attr/Meta#NameValue#(name_value) => meta_name_value_2_pathrust-analyzer cargo educe 0.6.0 common/path/meta_name_value_2_path().(name_value),
26 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Listrust-analyzer cargo syn 2.0.119 attr/Meta#List#(list) => {
27 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lit) = list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().::<LitStrrust-analyzer cargo syn 2.0.119 lit/LitStr#>() {
28 lit.parserust-analyzer cargo syn 2.0.119 lit/impl#[LitStr]parse().()
29 } else {
30 list.parse_argsrust-analyzer cargo syn 2.0.119 attr/impl#[MetaList]parse_args().()
31 }
32 },
33 Metarust-analyzer cargo syn 2.0.119 attr/Meta#::Pathrust-analyzer cargo syn 2.0.119 attr/Meta#Path#(path) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(synrust-analyzer cargo syn 2.0.119 crate/::Errorrust-analyzer cargo syn 2.0.119 error/Error#::newrust-analyzer cargo syn 2.0.119 error/impl#[Error]new().(
34 path.spanrust-analyzer cargo syn 2.0.119 spanned/impl#[T][Spanned]span().(),
35 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("expected `{path} = Path` or `{path}(Path)`", path = path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(path)),
36 )),
37 }
38 }
39
40 #[inline]
41 pub(craterust-analyzer cargo educe 0.6.0 crate/) fn path_to_stringrust-analyzer cargo educe 0.6.0 common/path/path_to_string().(path: &Pathrust-analyzer cargo syn 2.0.119 path/Path#) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
42 path.into_token_streamrust-analyzer cargo quote 1.0.47 to_tokens/ToTokens#into_token_stream().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().(' ', "")
43 }