Expand description
Parallel access patterns for RustAST and PureFile.
§Thread Safety Notes
§RustAST (syn-based)
syn::File is NOT Send/Sync due to proc_macro2::Span containing
raw pointers. This means:
- Cannot share
RustASTacross threads withArc - Cannot use
thread::spawnwithRustAST
§PureFile (span-free)
PureFile is Send + Sync - fully thread-safe! This means:
- Can share with
Arc<PureFile>across threads - Can use rayon parallel iterators directly
- Ideal for parallel code analysis
§Practical Patterns for Murmuration
- PureFile + Arc: Share read-only AST across threads
- PureFile + COW: Clone-and-modify for parallel mutations
- Parse-per-thread: Each thread parses source independently
- Rayon for CPU-bound: Use rayon for parallel iteration on collections
Structs§
- CowMut
- Copy-on-Write mutation patterns for safe AST manipulation.
- MutResult
- Result of a mutation operation with Copy-on-Write semantics.
- Source
Parallel - Parallel patterns using source strings (thread-safe).