1use std::fmt;
2
3use nom::{
4 IResult,
5 bytes::complete::tag,
6 combinator::map
7};
8
9#[derive(Debug, PartialEq, Clone, Default)]
10pub struct SdpVersion;
11
12pub fn parse_version(input: &[u8]) -> IResult<&[u8], SdpVersion> {
13 map(tag("0"), |_| SdpVersion)(input)
14}
15
16impl fmt::Display for SdpVersion {
17 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18 write!(f, "0")
19 }
20}
21
22pub fn parse_version_line(input: &[u8]) -> IResult<&[u8], SdpVersion> {
23 let (input, _) = tag("v=")(input)?;
24 let (input, _) = parse_version(input)?;
25 let (input, _) = tag("\r\n")(input)?;
26 Ok((input, SdpVersion))
27}