diff options
author | HampusM <hampus@hampusmat.com> | 2023-12-25 22:53:13 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-12-28 12:00:11 +0100 |
commit | 607d8d50b76665b67ca6f3124aa81773bec110b7 (patch) | |
tree | 142a7c17c4e254eabd5a5396975921bca1869bec /macros/src/util | |
parent | c501a5cc770f632eba1529de09bd3ae2d7958de6 (diff) |
WIP Linkme dependency removalwithout-linkme
Diffstat (limited to 'macros/src/util')
-rw-r--r-- | macros/src/util/syn_path.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/macros/src/util/syn_path.rs b/macros/src/util/syn_path.rs index 26e2597..6efea01 100644 --- a/macros/src/util/syn_path.rs +++ b/macros/src/util/syn_path.rs @@ -1,16 +1,26 @@ use std::fmt::Write; use quote::ToTokens; -use syn::punctuated::Pair; +use syn::punctuated::{Pair, Punctuated}; pub trait SynPathExt { + fn new_empty() -> Self; + /// Converts the [`syn::Path`] to a [`String`]. fn to_string(&self) -> String; } impl SynPathExt for syn::Path { + fn new_empty() -> Self + { + Self { + leading_colon: None, + segments: Punctuated::new(), + } + } + fn to_string(&self) -> String { self.segments.pairs().map(Pair::into_tuple).fold( |