AAM (Abstract Alias Mapping)
A robust and lightweight configuration library for Rust built around the new pipeline-backed AAM API.
It parses .aam files (key = value), supports directives (@import, @derive, @schema, @type), and provides
fast query and formatting utilities.
What changed in 2.x
AAMis now the primary API.- Parsing/loading returns
Result<_, Vec<AamlError>>to preserve full diagnostics. - Query methods are now centered around
get,find,find_by,deep_search, andreverse_search. - Pipeline formatter and LSP helper methods are available directly on
AAM. AAMLremains available for backward compatibility, but is deprecated.
Features
- Simple
key = valuesyntax. - Directive support:
@import,@derive,@schema,@type. - Schema/type validation via pipeline.
- Search helpers for key lookup, reverse lookup, and predicate filtering.
- Formatter utilities (
format,format_range) and LSP assist (lsp_assist). - Optional AOT loading (
.aam.bin) for fast startup (aotfeature; enabled by default). - Fluent config generation with
AAMBuilder.
Format
You can find syntax documentation and examples at: https://aam.ininids.in.rs/
Installation
Add the crate to your Cargo.toml:
[]
= "2.0.2"
Configuration syntax (.aam)
# Comments are supported
host = "localhost"
port = 8080
@import database.aam
@import theme.aam
@type port_t = i32
@schema Service {
host: string
port: port_t
}
Usage (new AAM API)
1) Parse and load
use AAM;
use AamlError;
2) Lookups and queries
use AAM;
let cfg = AAMparse.unwrap;
// O(1) key lookup
assert_eq!;
// key-first lookup, then reverse lookup by value
let found = cfg.find;
assert_eq!;
// reverse lookup only
let keys = cfg.reverse_search;
assert_eq!;
// key pattern search
let deep = cfg.deep_search;
assert_eq!;
// custom predicate
let filtered = cfg.find_by;
assert_eq!;
3) Iteration and extraction
use AAM;
let cfg = AAMparse.unwrap;
for in cfg.iter
let keys = cfg.keys;
let map = cfg.to_map;
assert!;
assert_eq!;
4) Formatting and LSP helper
use AAM;
use ;
let cfg = AAMnew;
let src = "host=localhost\nport=8080";
let formatted = cfg.format.unwrap;
let _range = cfg
.format_range
.unwrap;
let assist = AAMlsp_assist;
assert!;
5) Builder (AAMBuilder)
use ;
let mut builder = new;
builder
.comment
.type_alias
.schema
.add_line
.add_line;
println!;
builder.to_file.unwrap;
Legacy API (AAML, deprecated)
AAML is still available for compatibility and supports methods such as:
parse,loadmerge_content,merge_filefind_obj,find_key,find_deepvalidate_value,apply_schema,validate_schemas_completeness
For migration guidance, see docs/AAML_TO_AAM_MIGRATION.md.
Bindings
Node.js / N-API
C# / .NET
Quick verification commands
API reference (high-level)
AAM
- Constructors/loaders:
new,parse,load,from_pipeline - Query:
get,find,find_by,deep_search,reverse_search - Iteration/export:
iter,keys,to_map - Introspection:
schemas,get_schema,types,get_type - Formatting/LSP:
format,format_range,lsp_assist - AOT (feature-gated):
cook,load_fast
AAMBuilder
new,with_capacityadd_line,commentschema,schema_multiline,derive,import,type_aliasto_file,build,as_string
AamlError
Typed errors used across parser, validator, and runtime paths.
License
See LICENSE-MIT and LICENSE-APACHE.
Full documentation
- Docs.rs: https://docs.rs/aam-rs/
- Project docs: https://aam.ininids.in.rs/