warcat 0.3.0

Command-line tool and library for handling Web ARChive (WARC) files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use nom::{
    bytes::complete::{tag, take_while},
    character::complete::line_ending,
    combinator::recognize,
    sequence::{pair, terminated},
    IResult,
};

pub fn version(input: &[u8]) -> IResult<&[u8], &[u8]> {
    let tag = tag("WARC/");
    let digits = take_while(|c: u8| c.is_ascii_digit() || c == b'.');

    recognize(pair(tag, digits))(input)
}

pub fn version_line(input: &[u8]) -> IResult<&[u8], &[u8]> {
    terminated(version, line_ending)(input)
}