Skip to main content

AAM

Struct AAM 

Source
pub struct AAM { /* private fields */ }
Expand description

The main AAM configuration store.

Holds the final, validated output of the AAM pipeline, including the key-value map, schemas, and registered types.

Implementations§

Source§

impl AAM

Source

pub fn new() -> Self

Creates an empty dynamic AAM document.

Source

pub fn parse(text: &str) -> Result<Self, Vec<AamlError>>

Parses an AAM string using the default Pipeline and returns a new AAM instance.

If text is a path to an existing file on disk, it is loaded and parsed dynamically (with full schema support), bypassing the AOT cache. Otherwise, text is treated as raw AAM content.

§Errors

Returns errors if the file cannot be read, the content fails to parse, or validation fails.

Source

pub fn from_pipeline( pipeline: &Pipeline, text: &str, ) -> Result<Self, Vec<AamlError>>

Creates an AAM instance from a custom configured Pipeline. Use this if you need to register custom commands, parsers, or validators.

If text is a path to an existing file on disk, it is loaded and parsed as a file. Otherwise, text is treated as raw AAM content.

§Errors

Returns errors if the file cannot be read, the content fails to parse, or validation fails.

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self, Vec<AamlError>>

Loads an .aam file from disk.

With aot enabled (default), this uses the cooked .aam.bin cache as the primary path and only invokes parsing/cooking when the cache is missing/stale. This provides zero-copy memory mapping without any allocations.

§Errors

Returns errors if the file cannot be read, the cache cannot be memory-mapped, or the content fails to parse/validate.

Source

pub fn format( &self, content: &str, options: &FormattingOptions, ) -> Result<String, AamlError>

Formats arbitrary AAM content using parser + pipeline formatter.

§Errors

Returns errors if parsing or formatting fails.

Source

pub fn format_range( &self, content: &str, range: FormatRange, options: &FormattingOptions, ) -> Result<String, AamlError>

Formats only a selected line range of arbitrary AAM content.

§Errors

Returns errors if parsing or formatting fails.

Source

pub fn lsp_assist(content: &str, options: &FormattingOptions) -> AamLspAssist

Convenience method for LSP servers: parse with recovery and optional formatting result.

Source

pub fn cook(path: impl AsRef<Path>) -> Result<PathBuf, Vec<AamlError>>

Explicitly cooks an .aam file into .aam.bin cache.

§Errors

Returns errors if the file cannot be read, the cache cannot be created, or the content fails to parse/validate.

Source

pub fn load_fast(path: impl AsRef<Path>) -> Result<MappedAam, Vec<AamlError>>

Exposes zero-copy fast loading for advanced runtime integrations.

§Errors

Returns errors if the file cannot be read, the cache cannot be memory-mapped, or the source file is invalid and rebuilding fails.

Deep Search: Finds all key-value pairs where the key contains the specified pattern.

Reverse Search: Finds all keys that match the specified target value.

Source

pub fn find_by<F>(&self, predicate: F) -> Vec<(&str, &str)>
where F: Fn(&str, &str) -> bool,

Advanced search using a custom predicate function.

Source

pub fn find<'a>(&'a self, query: &'a str) -> Vec<(&'a str, &'a str)>

Find by key or value with fallback. First tries to find exactly by key (O(1) lookup), if not found, searches for matching values (O(N) iteration).

Source

pub fn get(&self, key: &str) -> Option<&str>

Retrieves a string value by its key. Performs an O(1) lookup. When AOT is enabled, this is a zero-copy operation straight from the memory-mapped file.

Source

pub fn iter(&self) -> Box<dyn Iterator<Item = (&str, &str)> + '_>

Iterates over all key-value pairs without allocating memory. Supports both dynamic HashMaps and memory-mapped AOT iterators.

Source

pub fn keys(&self) -> Vec<&str>

Returns all keys currently stored. Prefer AAM::iter for zero-allocation iteration.

Source

pub fn to_map(&self) -> PipelineHashMap<String, String>

Returns all key-value pairs as a standard allocated map. Prefer AAM::iter for zero-allocation iteration.

Source

pub const fn schemas(&self) -> Option<&PipelineHashMap<SmolStr, SchemaInfo>>

Returns a reference to all registered schemas, if loaded dynamically. Returns None if the configuration was loaded via an AOT memory map.

Source

pub fn get_schema(&self, name: &str) -> Option<&SchemaInfo>

Returns a specific schema by name, if it exists and was loaded dynamically.

Source

pub const fn types(&self) -> Option<&PipelineHashMap<SmolStr, TypeInfo>>

Returns a reference to all registered types, if loaded dynamically. Returns None if the configuration was loaded via an AOT memory map.

Source

pub fn get_type(&self, name: &str) -> Option<&TypeInfo>

Returns a specific type info by name, if it exists and was loaded dynamically.

Trait Implementations§

Source§

impl Debug for AAM

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AAM

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> IntoIterator for &'a AAM

Source§

type Item = (&'a str, &'a str)

The type of the elements being iterated over.
Source§

type IntoIter = Box<dyn Iterator<Item = (&'a str, &'a str)> + 'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl Freeze for AAM

§

impl RefUnwindSafe for AAM

§

impl Send for AAM

§

impl Sync for AAM

§

impl Unpin for AAM

§

impl UnsafeUnpin for AAM

§

impl UnwindSafe for AAM

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.