mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2025-01-05 12:38:39 +00:00
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:
parent
e4e1717b0a
commit
f7587aa264
1 changed files with 9 additions and 10 deletions
11
src/lib.rs
11
src/lib.rs
|
@ -131,9 +131,8 @@ use playlist::*;
|
||||||
/// }
|
/// }
|
||||||
pub fn parse_playlist(input: &[u8]) -> IResult<&[u8], Playlist> {
|
pub fn parse_playlist(input: &[u8]) -> IResult<&[u8], Playlist> {
|
||||||
match is_master_playlist(input) {
|
match is_master_playlist(input) {
|
||||||
// XXX: get rid of the local `map` to be able to `use` this
|
true => map(parse_master_playlist, Playlist::MasterPlaylist)(input),
|
||||||
true => nom::combinator::map(parse_master_playlist, Playlist::MasterPlaylist)(input),
|
false =>map(parse_media_playlist, Playlist::MediaPlaylist)(input),
|
||||||
false => nom::combinator::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!("#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!(do_parse!(tag!("#EXT-X-BYTERANGE:") >> r:byte_range_val >> (r)), SegmentTag::ByteRange)
|
||||||
| map!(tag!("#EXT-X-DISCONTINUITY"), |_| SegmentTag::Discontinuity)
|
| 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-KEY:") >> k: key >> (k)), SegmentTag::Key)
|
||||||
| map!(do_parse!(tag!("#EXT-X-MAP:") >> m:map >> (m)), SegmentTag::Map)
|
| 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-PROGRAM-DATE-TIME:") >> t:consume_line >> (t)), SegmentTag::ProgramDateTime)
|
||||||
| map!(do_parse!(tag!("#EXT-X-DATE-RANGE:") >> t:consume_line >> (t)), SegmentTag::DateRange)
|
| 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 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
|
// Basic tags
|
||||||
|
|
Loading…
Reference in a new issue