Function simple_text_editor::ops::parse[][src]

pub fn parse(input: &str) -> Option<(usize, Vec<Operation<'_>>)>

Parse all operations from combined input, including the command count (first line).

use simple_text_editor::ops::*;
assert_eq!(
    parse(
        r#"4
1 abc
2 1
3 1
4
"#
    ),
    Some((
        4 as usize,
        vec![
            Operation::Append("abc"),
            Operation::Delete(1),
            Operation::Print(1),
            Operation::Undo,
        ]
    ))
);