File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,21 @@ pub fn parse_lib_pp(
335335 }
336336}
337337
338+ /// Extracts the first matching variant from an iterator of `RefNode` values.
339+ ///
340+ /// This macro takes an iterator (`$n`) and a list of `RefNode` variant types (`$ty`),
341+ /// returning the first occurrence of any specified variant as `Some(RefNode::<$ty>)`.
342+ /// If no matching variant is found, it returns `None`.
343+ ///
344+ /// # Arguments
345+ ///
346+ /// - `$n`: An iterator over `RefNode` values.
347+ /// - `$ty`: One or more `RefNode` variant names to search for.
348+ ///
349+ /// # Returns
350+ ///
351+ /// - `Some(RefNode::<$ty>)` if a matching variant is found.
352+ /// - `None` if no matching variant is found.
338353#[ macro_export]
339354macro_rules! unwrap_node {
340355 ( $n: expr, $( $ty: tt ) ,+) => { {
@@ -351,6 +366,20 @@ macro_rules! unwrap_node {
351366 } } ;
352367}
353368
369+ /// Extracts the first `Locate` variant from an iterator of `RefNode`.
370+ ///
371+ /// This macro takes an expression that evaluates to an iterable collection
372+ /// of `RefNode` elements and returns the first `Locate` variant found,
373+ /// if any. If no `Locate` variant is found, it returns `None`.
374+ ///
375+ /// # Arguments
376+ ///
377+ /// * `$n:expr` - An expression yielding an iterator over `RefNode` values.
378+ ///
379+ /// # Returns
380+ ///
381+ /// * `Option<Locate>` - The first `Locate` variant found in the iterator, or `None` if none exist.
382+ ///
354383#[ macro_export]
355384macro_rules! unwrap_locate {
356385 ( $n: expr) => { {
You can’t perform that action at this time.
0 commit comments