Skip to main content

Module pure

Module pure 

Source
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 with Arc
  • 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§

PureAttribute
An attribute (e.g., #[derive(Debug)]).
PureBlock
A block of statements.
PureClosureParam
Closure parameter with optional type annotation.
PureConst
A const item.
PureDefRefs
Definition and Reference analysis for PureFile.
PureEnum
An enum definition.
PureField
A struct field.
PureFile
A complete Rust source file (pure, no spans).
PureFn
A function definition.
PureGenerics
Generic parameters.
PureImpl
An impl block.
PureMacro
A macro invocation at item level.
PureMatchArm
Match arm.
PureMod
A module definition.
PureParallel
Parallel processing utilities for PureFile.
PureRename
Rename operation for PureFile.
PureRenameResult
Result of a rename operation.
PureStatic
A static item.
PureStruct
A struct definition.
PureSymbol
Symbol information in PureFile.
PureSymbolTable
Symbol table for PureFile.
PureTrait
A trait definition.
PureTupleField
A tuple-style field (positional, no name).
PureTypeAlias
A type alias.
PureUse
A use statement.
PureVariant
An enum variant.

Enums§

ItemKind
Kind of AST item (shared vocabulary across crates).
MacroDelimiter
Macro delimiter.
ModScope
Prod/Test scope discriminant for PureMod.
PureAttrMeta
The meta content of an attribute.
PureExpr
An expression.
PureFields
Struct fields.
PureGenericParam
A generic parameter.
PureImplItem
An item in an impl block.
PureItem
An item in a file or module.
PureParam
Function parameter.
PurePattern
A pattern.
PureStmt
A statement.
PureSymbolKind
Kind of symbol in PureFile.
PureTraitItem
An item in a trait.
PureType
A type.
PureUseTree
A use tree.
PureVis
Visibility.
ToSynError
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.