pub struct AAML { /* private fields */ }please use AAM and Pipeline instead
Expand description
The main AAML parser and configuration store.
Holds a flat key-value map, registered type definitions, command handlers,
and schema definitions. All directives (@derive, @schema, etc.) are
processed at parse time.
ยงExample
use aam_core::aaml::AAML;
let cfg = AAML::parse("host = localhost\nport = 8080").unwrap();
assert_eq!(cfg.find_obj("host").unwrap().as_str(), "localhost");Implementationsยง
Sourceยงimpl AAML
impl AAML
Sourcepub fn find_obj(&self, key: &str) -> Option<FoundValue>
pub fn find_obj(&self, key: &str) -> Option<FoundValue>
Looks up key in the map. If not found as a key, performs a reverse
lookup โ searching for an entry whose value matches key.
Sourcepub fn find_key(&self, value: &str) -> Option<FoundValue>
pub fn find_key(&self, value: &str) -> Option<FoundValue>
Reverse lookup: finds the key whose value equals value.
Sourcepub fn find_deep(&self, key: &str) -> Option<FoundValue>
pub fn find_deep(&self, key: &str) -> Option<FoundValue>
Follows a chain of key -> value -> key lookups until a terminal value is reached or a cycle is detected.
Sourceยงimpl AAML
impl AAML
Sourcepub fn validate_schemas_completeness(&self) -> Result<(), AamlError>
pub fn validate_schemas_completeness(&self) -> Result<(), AamlError>
Checks every required field in every registered schema against the current map.
Optional fields (declared with *) are skipped.
Sourcepub fn validate_schemas_completeness_for(
&self,
schema_names: &[&str],
) -> Result<(), AamlError>
pub fn validate_schemas_completeness_for( &self, schema_names: &[&str], ) -> Result<(), AamlError>
Checks required fields only for the named schemas.
Used by @derive to validate only child-defined schemas, not inherited ones.
Sourcepub fn apply_schema(
&self,
schema_name: &str,
data: &HashMap<String, String>,
) -> Result<(), AamlError>
pub fn apply_schema( &self, schema_name: &str, data: &HashMap<String, String>, ) -> Result<(), AamlError>
Validates a complete data map against the named schema.
For every required field declared in the schema the method checks:
- The key is present in
data. - The value satisfies the declared type (including nested schemas and lists).
Optional fields (declared with *) are only validated when they are
present in data; their absence is not an error.
Sourceยงimpl AAML
impl AAML
pub const fn get_schemas(&self) -> &HashMap<String, SchemaDef>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new AAML instance pre-allocated for capacity key-value entries.
pub fn get_schema(&self, name: &str) -> Option<&SchemaDef>
Sourcepub fn register_command<C: Command + 'static>(&mut self, command: C)
pub fn register_command<C: Command + 'static>(&mut self, command: C)
Registers a custom command handler.
Sourcepub fn register_type<T: Type + 'static>(&mut self, name: String, type_def: T)
pub fn register_type<T: Type + 'static>(&mut self, name: String, type_def: T)
Registers a named type definition for use in schema field validation.
Sourcepub fn get_type(&self, name: &str) -> Option<&dyn Type>
pub fn get_type(&self, name: &str) -> Option<&dyn Type>
Returns the type handler registered under name, or None.
Sourcepub fn unregister_type(&mut self, name: &str)
pub fn unregister_type(&mut self, name: &str)
Removes the type registered under name.
Sourcepub fn check_type(&self, type_name: &str, value: &str) -> Result<(), AamlError>
pub fn check_type(&self, type_name: &str, value: &str) -> Result<(), AamlError>
Validates value against a type registered under type_name.
ยงErrors
Returns AamlError if the type is not found or validation fails.
Sourcepub fn validate_value(
&self,
type_name: &str,
value: &str,
) -> Result<(), AamlError>
pub fn validate_value( &self, type_name: &str, value: &str, ) -> Result<(), AamlError>
Validates value against the type registered as type_name, also
resolving built-in primitive types and module paths.
ยงErrors
Returns AamlError if the type is not found or validation fails.
Sourcepub fn merge_content(&mut self, content: &str) -> Result<(), AamlError>
pub fn merge_content(&mut self, content: &str) -> Result<(), AamlError>
Parses AAML content from a string, merging it into this instance.
ยงErrors
Returns AamlError if parsing fails (e.g., syntax errors, IO errors).
Sourcepub fn merge_file<P: AsRef<Path>>(
&mut self,
file_path: P,
) -> Result<(), AamlError>
pub fn merge_file<P: AsRef<Path>>( &mut self, file_path: P, ) -> Result<(), AamlError>
Reads a file from the disk and merges its content into this instance.
Sourcepub fn parse(content: &str) -> Result<Self, AamlError>
pub fn parse(content: &str) -> Result<Self, AamlError>
Parses an AAML string and returns a new AAML instance.
Sourcepub fn load<P: AsRef<Path>>(file_path: P) -> Result<Self, AamlError>
pub fn load<P: AsRef<Path>>(file_path: P) -> Result<Self, AamlError>
Loads an AAML file from the disk and returthe ns a new AAML instance.
Sourcepub fn unwrap_quotes(s: &str) -> &str
pub fn unwrap_quotes(s: &str) -> &str
Strips surrounding "โฆ" or 'โฆ' quotes. Returns the trimmed string unchanged
if it is not quoted.
pub fn import_schema( &mut self, name: &str, source: &mut Self, ) -> Result<(), AamlError>
pub fn merge_map_weak( &mut self, other_map: &mut HashMap<Box<str>, Box<str>, RandomState>, )
Trait Implementationsยง
Sourceยงimpl AddAssign for AAML
Available on crate feature legacy only.
impl AddAssign for AAML
legacy only.Sourceยงfn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreAuto Trait Implementationsยง
impl !RefUnwindSafe for AAML
impl !Send for AAML
impl !Sync for AAML
impl !UnwindSafe for AAML
impl Freeze for AAML
impl Unpin for AAML
impl UnsafeUnpin for AAML
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.