Expand description
PureAST - Thread-safe, Span-free AST for parallel processing.
§Design Philosophy
syn::File contains proc_macro2::Span which prevents it from being
Send/Sync. PureAST strips all span information, creating a clean
data structure that can be safely shared across threads.
§Features
- Thread-safe:
Send + Sync- share across threads withArc - Lightweight: No span overhead, smaller memory footprint
- Serializable: Can be serialized for IPC or persistence
- Bidirectional: Convert to/from
syn::File
§Usage
ⓘ
use std::sync::Arc;
use ryo_source::pure::PureFile;
let pure = PureFile::from_source("fn main() {}")?;
let shared = Arc::new(pure);
// Now safe to share across threads!
let handle = std::thread::spawn({
let shared = Arc::clone(&shared);
move || shared.functions().len()
});Modules§
- macro_
utils - Macro token parsing utilities for walking struct literals inside macros.
Structs§
- Pure
Attribute - An attribute (e.g.,
#[derive(Debug)]). - Pure
Block - A block of statements.
- Pure
Closure Param - Closure parameter with optional type annotation.
- Pure
Const - A const item.
- Pure
DefRefs - Definition and Reference analysis for PureFile.
- Pure
Enum - An enum definition.
- Pure
Field - A struct field.
- Pure
File - A complete Rust source file (pure, no spans).
- PureFn
- A function definition.
- Pure
Generics - Generic parameters.
- Pure
Impl - An impl block.
- Pure
Macro - A macro invocation at item level.
- Pure
Match Arm - Match arm.
- PureMod
- A module definition.
- Pure
Parallel - Parallel processing utilities for PureFile.
- Pure
Rename - Rename operation for PureFile.
- Pure
Rename Result - Result of a rename operation.
- Pure
Static - A static item.
- Pure
Struct - A struct definition.
- Pure
Symbol - Symbol information in PureFile.
- Pure
Symbol Table - Symbol table for PureFile.
- Pure
Trait - A trait definition.
- Pure
Tuple Field - A tuple-style field (positional, no name).
- Pure
Type Alias - A type alias.
- PureUse
- A use statement.
- Pure
Variant - An enum variant.
Enums§
- Item
Kind - Kind of AST item (shared vocabulary across crates).
- Macro
Delimiter - Macro delimiter.
- ModScope
- Prod/Test scope discriminant for
PureMod. - Pure
Attr Meta - The meta content of an attribute.
- Pure
Expr - An expression.
- Pure
Fields - Struct fields.
- Pure
Generic Param - A generic parameter.
- Pure
Impl Item - An item in an impl block.
- Pure
Item - An item in a file or module.
- Pure
Param - Function parameter.
- Pure
Pattern - A pattern.
- Pure
Stmt - A statement.
- Pure
Symbol Kind - Kind of symbol in PureFile.
- Pure
Trait Item - An item in a trait.
- Pure
Type - A type.
- Pure
UseTree - A use tree.
- PureVis
- Visibility.
- ToSyn
Error - Error type for ToSyn conversions.
Traits§
- ToPure
- Trait for converting syn types to pure types.
- ToSyn
- Trait for converting Pure types back to syn types.
Functions§
- format_
files_ with_ rustfmt - Format multiple files in-place using a single rustfmt invocation.