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/internals/respan.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 / internals / respan.rs` 16 lines ยท 451 bytes Raw Blame History 1 use proc_macro2::{Group, Span, TokenStream, TokenTree}; 2 3 pub(crate) fn respan(stream: TokenStream, span: Span) -> TokenStream { 4 stream 5 .into_iter() 6 .map(|token| respan_token(token, span)) 7 .collect() 8 } 9 10 fn respan_token(mut token: TokenTree, span: Span) -> TokenTree { 11 if let TokenTree::Group(g) = &mut token { 12 *g = Group::new(g.delimiter(), respan(g.stream(), span)); 13 } 14 token.set_span(span); 15 token 16 }