1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use nom::character::is_digit;
use crate::parse::parse_u32;
use std::fmt;
use nom::{
IResult,
combinator::map_res,
bytes::complete::take_while
};
#[derive(Debug, PartialEq, Clone)]
pub struct SdpCodecIdentifier(pub u32);
impl fmt::Display for SdpCodecIdentifier {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}
pub fn parse_codec_identifier(input: &[u8]) -> IResult<&[u8], SdpCodecIdentifier> {
let (input, num) = map_res(take_while(is_digit), parse_u32)(input)?;
Ok((input, SdpCodecIdentifier(num)))
}