Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/serde_derive/src/this.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / serde_derive / src / this.rs` 32 lines ยท 1007 bytes Raw Blame History 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 }