builder_trait_decl

This commit is contained in:
Andrew Golovashevich 2025-11-15 22:51:39 +03:00
parent 4bb7d6f005
commit 87bf378b69
2 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,37 @@
#[macro_export]
macro_rules! builder_trait_decl {
(
$name:ident
$(<
$generic0Name:ident : $generic0Bound:path $(, $genericNName:ident : $genericNBound:path)*
>)?
$(: $base0:path $(, $baseN:path)*)?
{ $($body:tt)* }
) => {
trait $name
<
'source, 'pos, 'builder, C, P:Pos<'pos>, CS:CollectedSubstring<'source, C>
$(, $generic0Name : $generic0Bound $(, $genericNName : $genericNBound)* )?
>
$(: $base0 $(, $baseN)*)?
{ $($body)* }
};
(
$name:ident
<
$lifetime0Name:lifetime $(, $lifetimeNName:lifetime)*
$(, $genericNName:ident : $genericNBound:path)*
>
$(: $base0:path $(, $baseN:path)*)?
{ $($body:tt)* }
) => {
fn $name
<
'source, 'pos, 'builder, $lifetime0Name $(, $lifetimeNName)*,
C, P: Pos<'pos>, CS: CollectedSubstring<'source, C>
$(, $genericNName : $genericNBound)*
>
$(: $base0 $(, $baseN)*)?
{ $($body)* }
};
}

View File

@ -1,2 +1,3 @@
mod builder_type_t; mod builder_type_t;
mod parser_func; mod parser_func;
mod builder_trait_decl;