You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-2Lines changed: 52 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,61 @@ A Rust library for handling syn objects with raw identifier prefixes and path no
11
11
`desynt` provides utilities for working with [`syn`](https://github.com/dtolnay/syn) objects, particularly focusing on:
12
12
13
13
-**Stripping raw identifier prefixes** (`r#`) from `Ident`, `Path`, and `PathSegment` objects
14
-
-**Path normalization** and canonical type resolution
15
-
-**Type mapping** from various path representations to canonical forms
14
+
-**Path resolution and normalization** via `PathResolver` for canonical type mapping
15
+
-**Built-in type support** for Rust primitives, prelude types, and common std types
16
+
-**Multiple storage backends** - HashMap (dynamic) or phf::Map (static)
16
17
17
18
This library is especially useful when working with proc macros or code analysis tools where you need to normalize type references regardless of how they're written in the source code.
18
19
20
+
## Features
21
+
22
+
### Raw Identifier Stripping
23
+
24
+
Use the `StripRaw` trait to remove `r#` prefixes from syn objects:
25
+
26
+
```rust
27
+
usesyn::Ident;
28
+
usedesynt::StripRaw;
29
+
30
+
letident:Ident=syn::parse_str("r#type").unwrap();
31
+
letstripped=ident.strip_raw();
32
+
assert_eq!(stripped.to_string(), "type");
33
+
```
34
+
35
+
### Path Resolution
36
+
37
+
Use `PathResolver` to normalize type paths and resolve them to canonical forms. This is particularly useful in proc macros where types can be referenced in multiple ways:
0 commit comments