Skip to content
📖 Auto vs RustBook contents

Appendix ​

The following sections contain reference material you may find useful in your Auto journey, with comparisons to Rust equivalents where applicable.

Appendix A: Keywords ​

The following lists contain keywords that are reserved for use by the Auto language. As such, they cannot be used as identifiers. Identifiers are names of functions, variables, parameters, type fields, modules, packages, constants, static values, attributes, types, or specs.

Keywords Currently in Use ​

The following is a list of all keywords currently in use in Auto, with their functionality described and the equivalent Rust keyword noted.

Auto KeywordRust EquivalentDescription
actor(none)Define an actor type
asasType casting
breakbreakExit a loop immediately
comptime(none)Mark a function for compile-time execution
constconstDefine a constant
continuecontinueContinue to the next loop iteration
dyndynDynamic dispatch to a spec object
elseelseFallback for if and if let control flow
enumenumDefine an enumeration
extimplAttach methods to a type
externexternLink an external function or variable
falsefalseBoolean false literal
fnfnDefine a function
forforLoop over items from an iterator
has(none)Delegate behavior through composition
ififBranch based on a conditional expression
ininPart of for loop syntax
ismatchMatch a value to patterns; compose types
letletBind a variable
looploopLoop unconditionally
modmodDefine a module
mutmut(Rust) Denote mutability
on(none)Handle actor messages; subscribe to blueprints
pubpubDenote public visibility
returnreturnReturn from function
SelfSelfType alias for the type being defined
selfselfMethod subject
spectraitDefine a specification (shared behavior interface)
staticstaticGlobal variable
sysunsafeDenote system-level (unsafe) code
tell(none)Send a message to an actor
truetrueBoolean true literal
typestruct / typeDefine a data type or type alias
useuseBring symbols into scope
varlet mutDeclare a mutable variable
wherewhereConstrain a type with spec bounds
whilewhileLoop conditionally
yield(none)Return control to the runtime in a blueprint

Auto-Only Keywords ​

These keywords exist in Auto but have no direct Rust equivalent:

KeywordDescription
actorDefines an actor type that processes messages concurrently
comptimeMarks a function to execute at compile time
extAttaches methods to a type (replaces Rust's impl)
hasDelegates method calls to a contained type
isPattern matching (replaces match) and type composition
onMessage handler in actors; blueprint subscription
specDefines a behavior specification (replaces Rust's trait)
sysSystem-level code (replaces Rust's unsafe)
tellSends a message to an actor
varShorthand for mutable variable declaration

Rust Keywords Not in Auto ​

These Rust keywords don't exist in Auto because Auto handles their use cases differently:

Rust KeywordAuto EquivalentReason
async~T return typeBlueprints are indicated by type, not keyword
awaiton blockSubscribe to blueprints instead of awaiting
crate(package root)Auto uses package-based module resolution
implextDifferent keyword, same concept
matchisDifferent keyword, same pattern syntax
move(implicit)Auto uses implicit move semantics
mutvarShorthand for mutable bindings
ref(not needed)AutoFree handles reference semantics
structtypeUnified type declaration keyword
super(parent reference)Auto uses use with parent paths
traitspecRenamed for Auto's semantics
unionunionOnly a keyword in union declarations

Keywords Reserved for Future Use ​

The following keywords do not yet have any functionality but are reserved by Auto for potential future use:

  • abstract
  • become
  • do
  • final
  • macro
  • override
  • priv
  • try
  • typeof
  • virtual

Appendix B: Operators and Symbols ​

Operators ​

Table B-1 contains the operators in Auto, with comparisons to Rust. Most operators are identical between the two languages.

OperatorExampleDescriptionAuto vs Rust
!!exprLogical complementSame
!=expr != exprNot equalSame
%expr % exprRemainderSame
%=var %= exprRemainder assignmentSame
&&exprBorrow / referenceSame
&expr & exprBitwise ANDSame
&&expr && exprLogical ANDSame
*expr * exprMultiplicationSame
**exprDereferenceSame
+expr + exprAdditionSame
+=var += exprAddition assignmentSame
--exprNegationSame
-expr - exprSubtractionSame
-=var -= exprSubtraction assignmentSame
->fn() -> typeFunction return typeSame syntax, also used in is arms
.expr.identField accessSame
...., expr.., ..exprRangeSame
..=expr..=exprInclusive rangeSame
..Type(x, ..)Ignore remaining fieldsSame concept, Auto uses () not {}
/expr / exprDivisionSame
/=var /= exprDivision assignmentSame
:ident: typeType annotationAuto: name Type (space, not colon) for fields
==expr == exprEqualitySame
=>pat => exprMatch armRust only; Auto uses ->
@ident @ patPattern bindingSame
^expr ^ exprBitwise XORSame
``pat | patPattern alternatives
||expr || exprLogical ORSame
?expr?Error propagationRust: expr? suffix; Auto: expr! suffix
~~expr, ~TBlueprint operatorAuto only: creates/transforms blueprints

Auto-Specific Operators ​

OperatorExampleDescription
~~5, ~TBlueprint creation / type operator
~race~race(a, b)First-completed blueprint wins
~join~join(a, b)Wait for all blueprints
~spawn~spawn(() => {})Run blueprint in background
~yield~yieldYield control to runtime
~sleep~sleep(ms)Non-blocking sleep
!expr!Error propagation (postfix)
??TOptional type (prefix on type)

Key Syntax Differences: Auto vs Rust ​

FeatureAutoRust
Match armspat -> exprpat => expr,
Error propagationexpr!expr?
Optional type?TOption<T>
Error type!TResult<T, E>
Blueprint type~Timpl Future<Output = T>
Type declarationtype Name { }struct Name { }
Method blockext Name { }impl Name { }
Spec/Traitspec Name { }trait Name { }
Pattern matchismatch
Unsafesys { }unsafe { }
Mutable varvar x = 5let mut x = 5
String formatf"${x}"format!("{}", x)
Printprint(x)println!("{}", x)
Assert equalassert_eq(a, b)assert_eq!(a, b)
Derive#derive[Debug]#[derive(Debug)]
Field separatorname Type (space)name: Type (colon)
Enum accessEnum.VariantEnum::Variant
Module pathuse.mod Nameuse mod::Name;

Non-operator Symbols ​

SymbolExplanationAuto vs Rust
"..."String literalSame
'c'Character literalSame
f"..."Format stringAuto: f"${expr}"; Rust: format!("{}", expr)
|...| exprClosureSame syntax
_Ignored pattern bindingSame
()Unit type / empty tupleSame
.Method call / field accessSame
#Attribute prefixAuto: #derive[...]; Rust: #[derive(...)]

Appendix C: Derivable Specs ​

In various places in the book, we've discussed the #derive[] attribute, which you can apply to a type or enum definition. The #derive[] attribute generates code that will implement a spec with its default implementation on the type you've annotated.

This is the Auto equivalent of Rust's #[derive(...)] attribute.

Debug for Programmer Output ​

The Debug spec enables debug formatting. In Auto, use {:?} in format strings:

auto
print(f"{my_value:?}")
rust
println!("{:?}", my_value);

Debug is required for assert_eq, which prints values when an assertion fails.

Eq for Equality Comparisons ​

The Eq spec (equivalent to Rust's PartialEq + Eq) enables equality comparison with == and !=:

auto
#derive[Eq]
type Color {
    r int
    g int
    b int
}

fn main() {
    let c1 = Color(r: 255, g: 0, b: 0)
    let c2 = Color(r: 255, g: 0, b: 0)
    assert(c1 == c2)
}
rust
#[derive(PartialEq, Eq)]
struct Color {
    r: i32,
    g: i32,
    b: i32,
}

fn main() {
    let c1 = Color { r: 255, g: 0, b: 0 };
    let c2 = Color { r: 255, g: 0, b: 0 };
    assert!(c1 == c2);
}

When derived on types, two instances are equal only if all fields are equal. When derived on enums, each variant equals itself and no others.

Ord for Ordering Comparisons ​

The Ord spec enables comparison operators <, >, <=, >=:

auto
#derive[Ord]
enum Priority {
    Low
    Medium
    High
}
rust
#[derive(PartialOrd, Ord)]
enum Priority {
    Low,
    Medium,
    High,
}

When derived on enums, variants declared earlier are considered less than variants declared later.

Clone for Duplicating Values ​

The Clone spec allows explicit deep copy of a value:

auto
#derive[Clone]
type Config {
    name String
    value int
}

fn main() {
    let original = Config(name: "test", value: 42)
    let copy = original.clone()
}
rust
#[derive(Clone)]
struct Config {
    name: String,
    value: i32,
}

fn main() {
    let original = Config { name: "test".to_string(), value: 42 };
    let copy = original.clone();
}

Hash for Mapping to Fixed-Size Values ​

The Hash spec enables using a type as a key in HashMap or HashSet:

auto
#derive[Hash, Eq]
type UserId {
    id int
}

fn main() {
    let mut scores = HashMap<UserId, int>()
    scores.insert(UserId(id: 1), 100)
}
rust
use std::collections::HashMap;

#[derive(Hash, PartialEq, Eq)]
struct UserId {
    id: i32,
}

fn main() {
    let mut scores = HashMap::new();
    scores.insert(UserId { id: 1 }, 100);
}

Default for Default Values ​

The Default spec provides a default value for a type:

auto
#derive[Default]
type Config {
    host String    // defaults to ""
    port int       // defaults to 0
    debug bool     // defaults to false
}

fn main() {
    let config = Config.default()
    // Override specific fields
    let config = Config(host: "localhost", ..Config.default())
}
rust
#[derive(Default)]
struct Config {
    host: String,
    port: i32,
    debug: bool,
}

fn main() {
    let config = Config::default();
    // Override specific fields
    let config = Config { host: "localhost".to_string(), ..Config::default() };
}

Derivable Specs Quick Reference ​

Auto SpecRust EquivalentEnables
DebugDebug{:?} formatting
EqPartialEq + Eq==, != operators
OrdPartialOrd + Ord&lt;, &gt;, &lt;=, &gt;= operators
CloneClone.clone() method
CopyCopyImplicit copy on assignment
HashHashUse as HashMap/HashSet key
DefaultDefault.default() method

Auto uses Eq as a single spec where Rust splits into PartialEq + Eq. Similarly, Auto's Ord covers both PartialOrd + Ord from Rust. This simplification works because Auto doesn't need to handle NaN edge cases in the same way — floating-point types have special handling built into the language.

Derive Syntax Comparison ​

FeatureAutoRust
Attribute#derive[Debug, Eq]#[derive(Debug, PartialEq, Eq)]
MultipleComma-separated in []Comma-separated in ()
Custom derive#apply[comptime_fn]Separate proc-macro crate

Appendix D: Auto vs Rust — Complete Mapping ​

This section provides a comprehensive mapping between Auto and Rust concepts covered throughout the book.

Type System ​

ConceptAutoRust
Define typetype Name { field Type }struct Name { field: Type }
Define enumenum Name { Variant }enum Name { Variant }
Methodsext Name { fn method() {} }impl Name { fn method(&self) {} }
Interfacespec Name { fn method() }trait Name { fn method(&self); }
Implement specspec Name for Type { }impl Name for Type { }
Genericfn name&lt;T&gt;(x T)fn name&lt;T&gt;(x: T)
Spec boundfn name&lt;T Spec&gt;(x T)fn name&lt;T: Trait&gt;(x: T)
Optional?TOption&lt;T&gt;
Result!TResult&lt;T, E&gt;
Blueprint~Timpl Future&lt;Output = T&gt;
Never type!!
Type aliastype Alias = Typetype Alias = Type;

Control Flow ​

ConceptAutoRust
Pattern matchismatch
Match armpat -&gt; exprpat =&gt; expr,
Conditionalif letif let
Error propagateexpr!expr?
Panicpanic("msg")panic!("msg")

Concurrency ​

ConceptAutoRust
UnitActorThread
Defineactor Name { }thread::spawn(|| { })
Send messageactor.tell(Msg)tx.send(msg)
Receiveon Msg(data) { }rx.recv()
Async type~Timpl Future&lt;Output = T&gt;
Awaiton bp as v { }bp.await
Race~race(a, b)tokio::select!
Join~join(a, b)tokio::join!(a, b)

OOP ​

ConceptAutoRust
Compositionis TypeManual embedding
Delegationhas TypeManual delegation
Dynamic dispatchdyn Specdyn Trait

Metaprogramming ​

ConceptAutoRust
Derive#derive[Spec]#[derive(Trait)]
Compile-timecomptime fnProcedural macro
Conditional#if[debug]#[cfg(debug)]
Unsafesys { }unsafe { }

Appendix E: Auto Package Tooling ​

automan vs cargo ​

CommandAuto (automan)Rust (cargo)
New projectautoman new namecargo new name
Buildautoman buildcargo build
Runautoman runcargo run
Testautoman testcargo test
Checkautoman checkcargo check
Add dependencyautoman add pkgAdd to Cargo.toml
Build releaseautoman build --releasecargo build --release
Package fileauto.tomlCargo.toml
Source directorysrc/src/
Entry pointsrc/main.atsrc/main.rs

Auto transpiles to C, so automan build ultimately produces a native binary through the system's C compiler. This means Auto programs can call C libraries directly without additional FFI bindings.

Released under the MIT License.