Skip to main content

Module parallel

Module parallel 

Source
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 RustAST across threads with Arc
  • Cannot use thread::spawn with RustAST

§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

  1. PureFile + Arc: Share read-only AST across threads
  2. PureFile + COW: Clone-and-modify for parallel mutations
  3. Parse-per-thread: Each thread parses source independently
  4. 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.
SourceParallel
Parallel patterns using source strings (thread-safe).