1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-12-23 12:30:29 +00:00

Apply rustfmt-0.99.1

This commit is contained in:
Takeru Ohta 2018-10-04 20:18:56 +09:00
parent c0597a2e5b
commit 8585016720
12 changed files with 58 additions and 52 deletions

View file

@ -3,9 +3,9 @@ extern crate hls_m3u8;
#[macro_use]
extern crate trackable;
use std::io::{self, Read};
use clap::{App, Arg};
use hls_m3u8::{MasterPlaylist, MediaPlaylist};
use std::io::{self, Read};
use trackable::error::Failure;
fn main() {
@ -16,8 +16,7 @@ fn main() {
.takes_value(true)
.default_value("media")
.possible_values(&["media", "master"]),
)
.get_matches();
).get_matches();
let mut m3u8 = String::new();
track_try_unwrap!(
io::stdin()

View file

@ -1,9 +1,9 @@
use std::fmt;
use std::str::FromStr;
use {Error, ErrorKind, Result};
use tags;
use types::SingleLineString;
use {Error, ErrorKind, Result};
#[derive(Debug)]
pub struct Lines<'a> {

View file

@ -1,13 +1,15 @@
use std::collections::HashSet;
use std::iter;
use std::fmt;
use std::iter;
use std::str::FromStr;
use {Error, ErrorKind, Result};
use line::{Line, Lines, Tag};
use tags::{ExtM3u, ExtXIFrameStreamInf, ExtXIndependentSegments, ExtXMedia, ExtXSessionData,
ExtXSessionKey, ExtXStart, ExtXStreamInf, ExtXVersion, MasterPlaylistTag};
use tags::{
ExtM3u, ExtXIFrameStreamInf, ExtXIndependentSegments, ExtXMedia, ExtXSessionData,
ExtXSessionKey, ExtXStart, ExtXStreamInf, ExtXVersion, MasterPlaylistTag,
};
use types::{ClosedCaptions, MediaType, ProtocolVersion, QuotedString};
use {Error, ErrorKind, Result};
/// Master playlist builder.
#[derive(Debug, Clone)]
@ -100,16 +102,14 @@ impl MasterPlaylistBuilder {
self.independent_segments_tag
.iter()
.map(|t| t.requires_version()),
)
.chain(self.start_tag.iter().map(|t| t.requires_version()))
).chain(self.start_tag.iter().map(|t| t.requires_version()))
.chain(self.media_tags.iter().map(|t| t.requires_version()))
.chain(self.stream_inf_tags.iter().map(|t| t.requires_version()))
.chain(
self.i_frame_stream_inf_tags
.iter()
.map(|t| t.requires_version()),
)
.chain(self.session_data_tags.iter().map(|t| t.requires_version()))
).chain(self.session_data_tags.iter().map(|t| t.requires_version()))
.chain(self.session_key_tags.iter().map(|t| t.requires_version()))
.max()
.expect("Never fails")

View file

@ -3,13 +3,15 @@ use std::iter;
use std::str::FromStr;
use std::time::Duration;
use {Error, ErrorKind, Result};
use line::{Line, Lines, Tag};
use media_segment::{MediaSegment, MediaSegmentBuilder};
use tags::{ExtM3u, ExtXDiscontinuitySequence, ExtXEndList, ExtXIFramesOnly,
ExtXIndependentSegments, ExtXMediaSequence, ExtXPlaylistType, ExtXStart,
ExtXTargetDuration, ExtXVersion, MediaPlaylistTag};
use tags::{
ExtM3u, ExtXDiscontinuitySequence, ExtXEndList, ExtXIFramesOnly, ExtXIndependentSegments,
ExtXMediaSequence, ExtXPlaylistType, ExtXStart, ExtXTargetDuration, ExtXVersion,
MediaPlaylistTag,
};
use types::ProtocolVersion;
use {Error, ErrorKind, Result};
/// Media playlist builder.
#[derive(Debug, Clone)]
@ -148,21 +150,18 @@ impl MediaPlaylistBuilder {
self.target_duration_tag
.iter()
.map(|t| t.requires_version()),
)
.chain(self.media_sequence_tag.iter().map(|t| t.requires_version()))
).chain(self.media_sequence_tag.iter().map(|t| t.requires_version()))
.chain(
self.discontinuity_sequence_tag
.iter()
.map(|t| t.requires_version()),
)
.chain(self.playlist_type_tag.iter().map(|t| t.requires_version()))
).chain(self.playlist_type_tag.iter().map(|t| t.requires_version()))
.chain(self.i_frames_only_tag.iter().map(|t| t.requires_version()))
.chain(
self.independent_segments_tag
.iter()
.map(|t| t.requires_version()),
)
.chain(self.start_tag.iter().map(|t| t.requires_version()))
).chain(self.start_tag.iter().map(|t| t.requires_version()))
.chain(self.end_list_tag.iter().map(|t| t.requires_version()))
.chain(self.segments.iter().map(|s| s.requires_version()))
.max()

View file

@ -1,10 +1,12 @@
use std::fmt;
use std::iter;
use {ErrorKind, Result};
use tags::{ExtInf, ExtXByteRange, ExtXDateRange, ExtXDiscontinuity, ExtXKey, ExtXMap,
ExtXProgramDateTime, MediaSegmentTag};
use tags::{
ExtInf, ExtXByteRange, ExtXDateRange, ExtXDiscontinuity, ExtXKey, ExtXMap, ExtXProgramDateTime,
MediaSegmentTag,
};
use types::{ProtocolVersion, SingleLineString};
use {ErrorKind, Result};
/// Media segment builder.
#[derive(Debug, Clone)]
@ -165,8 +167,7 @@ impl MediaSegment {
self.program_date_time_tag
.iter()
.map(|t| t.requires_version()),
)
.chain(iter::once(self.inf_tag.requires_version()))
).chain(iter::once(self.inf_tag.requires_version()))
.max()
.expect("Never fails")
}

View file

@ -1,8 +1,8 @@
use std::fmt;
use std::str::FromStr;
use {Error, ErrorKind, Result};
use types::ProtocolVersion;
use {Error, ErrorKind, Result};
/// [4.3.1.1. EXTM3U]
///

View file

@ -1,11 +1,13 @@
use std::fmt;
use std::str::FromStr;
use {Error, ErrorKind, Result};
use super::{parse_u64, parse_yes_or_no};
use attribute::AttributePairs;
use types::{ClosedCaptions, DecimalFloatingPoint, DecimalResolution, DecryptionKey, HdcpLevel,
InStreamId, MediaType, ProtocolVersion, QuotedString, SessionData, SingleLineString};
use super::{parse_yes_or_no, parse_u64};
use types::{
ClosedCaptions, DecimalFloatingPoint, DecimalResolution, DecryptionKey, HdcpLevel, InStreamId,
MediaType, ProtocolVersion, QuotedString, SessionData, SingleLineString,
};
use {Error, ErrorKind, Result};
/// `ExtXMedia` builder.
#[derive(Debug, Clone)]
@ -834,8 +836,8 @@ impl FromStr for ExtXSessionKey {
#[cfg(test)]
mod test {
use types::{EncryptionMethod, InitializationVector};
use super::*;
use types::{EncryptionMethod, InitializationVector};
#[test]
fn ext_x_media() {
@ -899,7 +901,7 @@ mod test {
method: EncryptionMethod::Aes128,
uri: quoted_string("foo"),
iv: Some(InitializationVector([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
])),
key_format: None,
key_format_versions: None,

View file

@ -1,10 +1,10 @@
use std::fmt;
use std::str::FromStr;
use {Error, ErrorKind, Result};
use super::parse_yes_or_no;
use attribute::AttributePairs;
use types::{ProtocolVersion, SignedDecimalFloatingPoint};
use super::parse_yes_or_no;
use {Error, ErrorKind, Result};
/// [4.3.5.1. EXT-X-INDEPENDENT-SEGMENTS]
///

View file

@ -3,8 +3,8 @@ use std::str::FromStr;
use std::time::Duration;
use trackable::error::ErrorKindExt;
use {Error, ErrorKind, Result};
use types::{PlaylistType, ProtocolVersion};
use {Error, ErrorKind, Result};
/// [4.3.3.1. EXT-X-TARGETDURATION]
///

View file

@ -4,10 +4,11 @@ use std::str::FromStr;
use std::time::Duration;
use trackable::error::ErrorKindExt;
use {Error, ErrorKind, Result};
use attribute::AttributePairs;
use types::{ByteRange, DecimalFloatingPoint, DecryptionKey, ProtocolVersion, QuotedString,
SingleLineString};
use types::{
ByteRange, DecimalFloatingPoint, DecryptionKey, ProtocolVersion, QuotedString, SingleLineString,
};
use {Error, ErrorKind, Result};
/// [4.3.2.1. EXTINF]
///
@ -480,8 +481,8 @@ impl FromStr for ExtXDateRange {
mod test {
use std::time::Duration;
use types::{EncryptionMethod, InitializationVector};
use super::*;
use types::{EncryptionMethod, InitializationVector};
#[test]
fn extinf() {
@ -555,7 +556,7 @@ mod test {
method: EncryptionMethod::Aes128,
uri: QuotedString::new("foo").unwrap(),
iv: Some(InitializationVector([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
])),
key_format: None,
key_format_versions: None,
@ -569,7 +570,7 @@ mod test {
method: EncryptionMethod::Aes128,
uri: QuotedString::new("foo").unwrap(),
iv: Some(InitializationVector([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
])),
key_format: Some(QuotedString::new("baz").unwrap()),
key_format_versions: None,

View file

@ -8,7 +8,7 @@ use {ErrorKind, Result};
macro_rules! may_invalid {
($expr:expr) => {
$expr.map_err(|e| track!(Error::from(ErrorKind::InvalidInput.cause(e))))
}
};
}
macro_rules! impl_from {
@ -18,17 +18,21 @@ macro_rules! impl_from {
$to::$from(f)
}
}
}
};
}
pub use self::basic::{ExtM3u, ExtXVersion};
pub use self::master_playlist::{ExtXIFrameStreamInf, ExtXMedia, ExtXSessionData, ExtXSessionKey,
ExtXStreamInf};
pub use self::master_playlist::{
ExtXIFrameStreamInf, ExtXMedia, ExtXSessionData, ExtXSessionKey, ExtXStreamInf,
};
pub use self::media_or_master_playlist::{ExtXIndependentSegments, ExtXStart};
pub use self::media_playlist::{ExtXDiscontinuitySequence, ExtXEndList, ExtXIFramesOnly,
ExtXMediaSequence, ExtXPlaylistType, ExtXTargetDuration};
pub use self::media_segment::{ExtInf, ExtXByteRange, ExtXDateRange, ExtXDiscontinuity, ExtXKey,
ExtXMap, ExtXProgramDateTime};
pub use self::media_playlist::{
ExtXDiscontinuitySequence, ExtXEndList, ExtXIFramesOnly, ExtXMediaSequence, ExtXPlaylistType,
ExtXTargetDuration,
};
pub use self::media_segment::{
ExtInf, ExtXByteRange, ExtXDateRange, ExtXDiscontinuity, ExtXKey, ExtXMap, ExtXProgramDateTime,
};
mod basic;
mod master_playlist;

View file

@ -5,8 +5,8 @@ use std::str::{self, FromStr};
use std::time::Duration;
use trackable::error::ErrorKindExt;
use {Error, ErrorKind, Result};
use attribute::AttributePairs;
use {Error, ErrorKind, Result};
/// String that represents a single line in a playlist file.
///