pub struct MacroRegistry { /* private fields */ }Expand description
Registry of macros with efficient lookup.
Macros are keyed by name:arg_count:is_receiver.
Lookup tries the exact key first, then falls back to a vararg key.
Implementations§
Source§impl MacroRegistry
impl MacroRegistry
Sourcepub fn lookup(
&self,
name: &str,
arg_count: usize,
is_receiver: bool,
) -> Option<&Macro>
pub fn lookup( &self, name: &str, arg_count: usize, is_receiver: bool, ) -> Option<&Macro>
Look up a macro by name, argument count, and receiver style.
First tries exact match, then falls back to vararg match if applicable.
Sourcepub fn contains(&self, name: &str) -> bool
pub fn contains(&self, name: &str) -> bool
Check if the registry contains a macro with the given name.
Sourcepub fn expected_args_description(
&self,
name: &str,
is_receiver: bool,
) -> Option<String>
pub fn expected_args_description( &self, name: &str, is_receiver: bool, ) -> Option<String>
Return a human-readable description of expected argument counts for a macro.
Given a macro name and whether it’s called as a receiver, collects all registered
argument counts and formats them (e.g., “exactly 1 argument”, “2 or 3 arguments”).
Returns None if no macros match the name + style.
Trait Implementations§
Source§impl Clone for MacroRegistry
impl Clone for MacroRegistry
Source§fn clone(&self) -> MacroRegistry
fn clone(&self) -> MacroRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MacroRegistry
impl Debug for MacroRegistry
Auto Trait Implementations§
impl Freeze for MacroRegistry
impl RefUnwindSafe for MacroRegistry
impl Send for MacroRegistry
impl Sync for MacroRegistry
impl Unpin for MacroRegistry
impl UnsafeUnpin for MacroRegistry
impl UnwindSafe for MacroRegistry
Blanket Implementations§
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
Mutably borrows from an owned value. Read more