cleanup, fn map renamed

Local `fn map` -> `fn extmap` that allows to use map from Nom directly, without `nom::combinator::`
This commit is contained in:
Vadim Getmanshchuk 2020-02-26 22:52:20 -08:00 committed by GitHub
parent e4e1717b0a
commit f7587aa264
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,9 +131,8 @@ use playlist::*;
/// }
pub fn parse_playlist(input: &[u8]) -> IResult<&[u8], Playlist> {
match is_master_playlist(input) {
// XXX: get rid of the local `map` to be able to `use` this
true => nom::combinator::map(parse_master_playlist, Playlist::MasterPlaylist)(input),
false => nom::combinator::map(parse_media_playlist, Playlist::MediaPlaylist)(input),
true => map(parse_master_playlist, Playlist::MasterPlaylist)(input),
false =>map(parse_media_playlist, Playlist::MediaPlaylist)(input),
}
}
@ -412,8 +411,8 @@ pub fn media_segment_tag(input: &[u8]) -> IResult<&[u8], SegmentTag> {
map!(do_parse!(tag!("#EXTINF:") >> e:duration_title_tag >> (e)), |(a,b)| SegmentTag::Extinf(a,b))
| map!(do_parse!(tag!("#EXT-X-BYTERANGE:") >> r:byte_range_val >> (r)), SegmentTag::ByteRange)
| map!(tag!("#EXT-X-DISCONTINUITY"), |_| SegmentTag::Discontinuity)
| map!(do_parse!(tag!("#EXT-X-KEY:") >> k:key >> (k)), SegmentTag::Key)
| map!(do_parse!(tag!("#EXT-X-MAP:") >> m:map >> (m)), SegmentTag::Map)
| map!(do_parse!(tag!("#EXT-X-KEY:") >> k: key >> (k)), SegmentTag::Key)
| map!(do_parse!(tag!("#EXT-X-MAP:") >> m: extmap >> (m)), SegmentTag::Map)
| map!(do_parse!(tag!("#EXT-X-PROGRAM-DATE-TIME:") >> t:consume_line >> (t)), SegmentTag::ProgramDateTime)
| map!(do_parse!(tag!("#EXT-X-DATE-RANGE:") >> t:consume_line >> (t)), SegmentTag::DateRange)
@ -438,7 +437,7 @@ named!(pub duration_title_tag<(f32, Option<String>)>,
named!(pub key<Key>, map!(key_value_pairs, Key::from_hashmap));
named!(pub map<Map>, map!(key_value_pairs, Map::from_hashmap));
named!(pub extmap<Map>, map!(key_value_pairs, Map::from_hashmap));
// -----------------------------------------------------------------------------------------------
// Basic tags