The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

nom Rust Parser Starter Snippet For IResult

TODO: Pull subtitle into page object
Code
use nom::IResult;

pub fn list(source: &str) -> IResult<&str, &str> {
    Ok((source, ""))
}

#[cfg(test)]
mod test {
    use super::*;
    use rstest::rstest;

    #[rstest]
    #[case(
            "a",
            Ok(("a", ""))
        )]
    fn example_test(#[case] input: &str, #[case] expected: IResult<&str, &str>) {
        assert_eq!(expected, do_thing(input));
    }
}

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

nom Rust Parser Starter Snippet For IResult

This is what I use to get started. 


-- code
-- rust



use nom::IResult;

pub fn list(source: &str) -> IResult<&str, &str> {
    Ok((source, ""))
}

#[cfg(test)]
mod test {
    use super::*;
    use rstest::rstest;

    #[rstest]
    #[case(
            "a",
            Ok(("a", ""))
        )]
    fn example_test(#[case] input: &str, #[case] expected: IResult<&str, &str>) {
        assert_eq!(expected, do_thing(input));
    }
}


-- categories
-- Rust 
-- nom

-- metadata
-- date: 2023-07-07 22:49:49
-- id: 2sgt8v1m
-- site: aws
-- type: post
-- status: scratch