diff --git a/src/parser/lesser_block.rs b/src/parser/lesser_block.rs index a039061e..96157274 100644 --- a/src/parser/lesser_block.rs +++ b/src/parser/lesser_block.rs @@ -265,13 +265,14 @@ fn _lesser_block_end<'r, 's, 'x>( Ok((remaining, source)) } -fn lesser_block_begin( - current_name: &str, +/// Parser for the beginning of a lesser block +/// +/// current_name MUST be lowercase. We do not do the conversion ourselves because it is not allowed in a const fn. +const fn lesser_block_begin( + current_name: &'static str, ) -> impl for<'r, 's> Fn(Context<'r, 's>, OrgSource<'s>) -> Res, OrgSource<'s>> { - let current_name_lower = current_name.to_lowercase(); - move |context: Context, input: OrgSource<'_>| { - _lesser_block_begin(context, input, current_name_lower.as_str()) - } + // TODO: Since this is a const fn, is there ANY way to "generate" functions at compile time? + move |context: Context, input: OrgSource<'_>| _lesser_block_begin(context, input, current_name) } #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]