mirror of
https://github.com/rutgersc/m3u8-rs.git
synced 2024-12-22 22:46:37 +00:00
Fix doc tests
This commit is contained in:
parent
e3d0cb8cff
commit
7583aaccba
1 changed files with 50 additions and 42 deletions
18
src/lib.rs
18
src/lib.rs
|
@ -12,6 +12,7 @@
|
||||||
//! use nom::IResult;
|
//! use nom::IResult;
|
||||||
//! use std::io::Read;
|
//! use std::io::Read;
|
||||||
//!
|
//!
|
||||||
|
//! fn main() {
|
||||||
//! let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
//! let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
||||||
//! let mut bytes: Vec<u8> = Vec::new();
|
//! let mut bytes: Vec<u8> = Vec::new();
|
||||||
//! file.read_to_end(&mut bytes).unwrap();
|
//! file.read_to_end(&mut bytes).unwrap();
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
//! IResult::Error(e) => panic!("Parsing error: \n{}", e),
|
//! IResult::Error(e) => panic!("Parsing error: \n{}", e),
|
||||||
//! IResult::Incomplete(e) => panic!("Parsing error: \n{:?}", e),
|
//! IResult::Incomplete(e) => panic!("Parsing error: \n{:?}", e),
|
||||||
//! }
|
//! }
|
||||||
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Parsing a master playlist directly
|
//! Parsing a master playlist directly
|
||||||
|
@ -40,12 +42,14 @@
|
||||||
//! use std::io::Read;
|
//! use std::io::Read;
|
||||||
//! use nom::IResult;
|
//! use nom::IResult;
|
||||||
//!
|
//!
|
||||||
|
//! fn main() {
|
||||||
//! let mut file = std::fs::File::open("masterplaylist.m3u8").unwrap();
|
//! let mut file = std::fs::File::open("masterplaylist.m3u8").unwrap();
|
||||||
//! let mut bytes: Vec<u8> = Vec::new();
|
//! let mut bytes: Vec<u8> = Vec::new();
|
||||||
//! file.read_to_end(&mut bytes).unwrap();
|
//! file.read_to_end(&mut bytes).unwrap();
|
||||||
//!
|
//!
|
||||||
//! if let IResult::Done(_, pl) = m3u8_rs::parse_master_playlist(&bytes) {
|
//! if let IResult::Done(_, pl) = m3u8_rs::parse_master_playlist(&bytes) {
|
||||||
//! println!("{}", pl);
|
//! println!("{:?}", pl);
|
||||||
|
//! }
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
@ -53,7 +57,10 @@
|
||||||
//! Creating a playlist and writing it back to a vec/file
|
//! Creating a playlist and writing it back to a vec/file
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
//! extern crate m3u8_rs;
|
||||||
|
//! use m3u8_rs::playlist::{MediaPlaylist, MediaPlaylistType, MediaSegment};
|
||||||
//!
|
//!
|
||||||
|
//! fn main() {
|
||||||
//! let playlist = MediaPlaylist {
|
//! let playlist = MediaPlaylist {
|
||||||
//! version: 6,
|
//! version: 6,
|
||||||
//! target_duration: 3.0,
|
//! target_duration: 3.0,
|
||||||
|
@ -72,11 +79,12 @@
|
||||||
//! ..Default::default()
|
//! ..Default::default()
|
||||||
//! };
|
//! };
|
||||||
//!
|
//!
|
||||||
//! let mut v: Vec<u8> = Vec::new();
|
//! //let mut v: Vec<u8> = Vec::new();
|
||||||
//! playlist_original.write_to(&mut v).unwrap();
|
//! //playlist.write_to(&mut v).unwrap();
|
||||||
//!
|
//!
|
||||||
//! let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
//! //let mut file = std::fs::File::open("playlist.m3u8").unwrap();
|
||||||
//! playlist_original.write_to(&mut file).unwrap();
|
//! //playlist.write_to(&mut file).unwrap();
|
||||||
|
//! }
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue