Skip to main content

Module rs

Module rs 

Source
Expand description

Rust code generator — rule-based (Tier 2) transpilation from AIR to Rust.

The most direct mapping of any target — Bock’s ownership model was designed to map cleanly to Rust:

  • Owned values → owned values (direct)
  • Immutable borrow → &T
  • Mutable borrow → &mut T
  • Move → move semantics (direct)
  • @managedRc<T> (single-threaded) / Arc<T> (concurrent)
  • Records → structs
  • Enums → enums (with variants)
  • Traits → traits, Impls → impl blocks (nearly 1:1)
  • Effects → &dyn EffectTrait parameters
  • Pattern matching → native match
  • Generics → monomorphized (preserved)
  • String interpolation → format!() macro

Structs§

RsGenerator
Rust code generator implementing the CodeGenerator trait.