pub fn parse_content_range(value: &[u8]) -> Result<ContentRange, ParseError>Expand description
Parses Content-Range (RFC 9110 section 14.4) for the bytes unit.
§Errors
ErrorKind::InvalidRange (another unit, a missing space, last < first,
last >= complete, a malformed shape); ErrorKind::InvalidNumber,
ErrorKind::NumberOverflow.
§Examples
use parse_net::{range::parse_content_range, ByteRange, ContentRange};
assert_eq!(parse_content_range(b"bytes 0-499/1234")?,
ContentRange::Satisfied { range: ByteRange { start: 0, end: 499 }, complete: Some(1234) });
assert_eq!(parse_content_range(b"bytes */0")?, ContentRange::Unsatisfied { complete: 0 });
assert!(parse_content_range(b"bytes 0-5/5").is_err());