Add a helper function for logging during debugging.
This commit is contained in:
@@ -155,3 +155,16 @@ pub fn not_yet_implemented() -> Res<OrgSource<'static>, ()> {
|
||||
"Not implemented yet.".into(),
|
||||
))));
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
/// Text from the current point until the next line break or end of file
|
||||
///
|
||||
/// Useful for debugging.
|
||||
pub fn text_until_eol<'r, 's>(
|
||||
input: OrgSource<'s>,
|
||||
) -> Result<&'s str, nom::Err<CustomError<OrgSource<'s>>>> {
|
||||
let line = recognize(many_till(anychar, alt((line_ending, eof))))(input)
|
||||
.map(|(_remaining, line)| Into::<&str>::into(line))?;
|
||||
Ok(line.trim())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user