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
impl AAM
Sourcepub fn parse(text: &str) -> Result<Self, Vec<AamlError>>
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.
Sourcepub fn from_pipeline(
pipeline: &Pipeline,
text: &str,
) -> Result<Self, Vec<AamlError>>
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.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, Vec<AamlError>>
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.
Sourcepub fn format(
&self,
content: &str,
options: &FormattingOptions,
) -> Result<String, AamlError>
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.
Sourcepub fn format_range(
&self,
content: &str,
range: FormatRange,
options: &FormattingOptions,
) -> Result<String, AamlError>
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.
Sourcepub fn lsp_assist(content: &str, options: &FormattingOptions) -> AamLspAssist
pub fn lsp_assist(content: &str, options: &FormattingOptions) -> AamLspAssist
Convenience method for LSP servers: parse with recovery and optional formatting result.
Sourcepub fn cook(path: impl AsRef<Path>) -> Result<PathBuf, Vec<AamlError>>
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.
Sourcepub fn load_fast(path: impl AsRef<Path>) -> Result<MappedAam, Vec<AamlError>>
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.
Sourcepub fn deep_search(&self, pattern: &str) -> Vec<(&str, &str)>
pub fn deep_search(&self, pattern: &str) -> Vec<(&str, &str)>
Deep Search: Finds all key-value pairs where the key contains the specified pattern.
Sourcepub fn reverse_search(&self, target_value: &str) -> Vec<&str>
pub fn reverse_search(&self, target_value: &str) -> Vec<&str>
Reverse Search: Finds all keys that match the specified target value.
Sourcepub fn find_by<F>(&self, predicate: F) -> Vec<(&str, &str)>
pub fn find_by<F>(&self, predicate: F) -> Vec<(&str, &str)>
Advanced search using a custom predicate function.
Sourcepub fn find<'a>(&'a self, query: &'a str) -> Vec<(&'a str, &'a str)>
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).
Sourcepub fn get(&self, key: &str) -> Option<&str>
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.
Sourcepub fn iter(&self) -> Box<dyn Iterator<Item = (&str, &str)> + '_>
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.
Sourcepub fn keys(&self) -> Vec<&str>
pub fn keys(&self) -> Vec<&str>
Returns all keys currently stored.
Prefer AAM::iter for zero-allocation iteration.
Sourcepub fn to_map(&self) -> PipelineHashMap<String, String>
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.
Sourcepub const fn schemas(&self) -> Option<&PipelineHashMap<SmolStr, SchemaInfo>>
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.
Sourcepub fn get_schema(&self, name: &str) -> Option<&SchemaInfo>
pub fn get_schema(&self, name: &str) -> Option<&SchemaInfo>
Returns a specific schema by name, if it exists and was loaded dynamically.
Trait Implementations§
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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.