pub fn parse_patch(patch: &str) -> Result<Vec<Hunk>, ParseError>Expand description
Parse a complete patch into its hunks. Strict: requires the Begin/End markers (tolerating surrounding blank lines) and rejects stray lines.
§Errors
ParseError::Invalid when the Begin Patch / End Patch markers are
missing or a line inside the body belongs to no hunk, and
ParseError::InvalidHunk — which carries the offending line number —
when a hunk’s own body is malformed. Purely textual: no path here is
opened or checked
for existence, so a patch against a file that is not there still parses.