1 | use crate::internals::ast::Container; |
2 | use syn::{Path, PathArguments, Token}; |
3 | |
4 | pub fn this_type(cont: &Container) -> Path { |
5 | if let Some(remote) = cont.attrs.remote() { |
6 | let mut this = remote.clone(); |
7 | for segment in &mut this.segments { |
8 | if let PathArguments::AngleBracketed(arguments) = &mut segment.arguments { |
9 | arguments.colon2_token = None; |
10 | } |
11 | } |
12 | this |
13 | } else { |
14 | Path::from(cont.ident.clone()) |
15 | } |
16 | } |
17 | |
18 | pub fn this_value(cont: &Container) -> Path { |
19 | if let Some(remote) = cont.attrs.remote() { |
20 | let mut this = remote.clone(); |
21 | for segment in &mut this.segments { |
22 | if let PathArguments::AngleBracketed(arguments) = &mut segment.arguments { |
23 | if arguments.colon2_token.is_none() { |
24 | arguments.colon2_token = Some(Token![::](arguments.lt_token.span)); |
25 | } |
26 | } |
27 | } |
28 | this |
29 | } else { |
30 | Path::from(cont.ident.clone()) |
31 | } |
32 | } |
33 | |