Skip to content

Commit

Permalink
Clean up read example to be more legible
Browse files Browse the repository at this point in the history
  • Loading branch information
tuffy committed Jun 14, 2024
1 parent 430e8b4 commit a13990d
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,7 @@
//!
//! ```
//! use std::io::{Cursor, Read};
//! use bitstream_io::{BigEndian, BitReader, BitRead, ByteReader, ByteRead, FromBitStream, FromByteStream, LittleEndian};
//!
//! let flac: Vec<u8> = vec![0x66,0x4c,0x61,0x43,0x00,0x00,0x00,0x22,
//! 0x10,0x00,0x10,0x00,0x00,0x06,0x06,0x00,
//! 0x21,0x62,0x0a,0xc4,0x42,0xf0,0x00,0x04,
//! 0xa6,0xcc,0xfa,0xf2,0x69,0x2f,0xfd,0xec,
//! 0x2d,0x5b,0x30,0x01,0x76,0xb4,0x62,0x88,
//! 0x7d,0x92,0x04,0x00,0x00,0x7a,0x20,0x00,
//! 0x00,0x00,0x72,0x65,0x66,0x65,0x72,0x65,
//! 0x6e,0x63,0x65,0x20,0x6c,0x69,0x62,0x46,
//! 0x4c,0x41,0x43,0x20,0x31,0x2e,0x31,0x2e,
//! 0x34,0x20,0x32,0x30,0x30,0x37,0x30,0x32,
//! 0x31,0x33,0x04,0x00,0x00,0x00,0x16,0x00,
//! 0x00,0x00,0x74,0x69,0x74,0x6c,0x65,0x3d,
//! 0x32,0x63,0x68,0x20,0x34,0x34,0x31,0x30,
//! 0x30,0x20,0x20,0x31,0x36,0x62,0x69,0x74,
//! 0x10,0x00,0x00,0x00,0x61,0x6c,0x62,0x75,
//! 0x6d,0x3d,0x54,0x65,0x73,0x74,0x20,0x41,
//! 0x6c,0x62,0x75,0x6d,0x0f,0x00,0x00,0x00,
//! 0x61,0x72,0x74,0x69,0x73,0x74,0x3d,0x41,
//! 0x73,0x73,0x6f,0x72,0x74,0x65,0x64,0x0d,
//! 0x00,0x00,0x00,0x74,0x72,0x61,0x63,0x6b,
//! 0x6e,0x75,0x6d,0x62,0x65,0x72,0x3d,0x31];
//! use bitstream_io::*;
//!
//! #[derive(Debug, PartialEq, Eq)]
//! struct BlockHeader {
Expand Down Expand Up @@ -119,6 +97,29 @@
//! }
//! }
//!
//! // test FLAC file data
//! let flac: Vec<u8> = vec![0x66,0x4c,0x61,0x43,0x00,0x00,0x00,0x22,
//! 0x10,0x00,0x10,0x00,0x00,0x06,0x06,0x00,
//! 0x21,0x62,0x0a,0xc4,0x42,0xf0,0x00,0x04,
//! 0xa6,0xcc,0xfa,0xf2,0x69,0x2f,0xfd,0xec,
//! 0x2d,0x5b,0x30,0x01,0x76,0xb4,0x62,0x88,
//! 0x7d,0x92,0x04,0x00,0x00,0x7a,0x20,0x00,
//! 0x00,0x00,0x72,0x65,0x66,0x65,0x72,0x65,
//! 0x6e,0x63,0x65,0x20,0x6c,0x69,0x62,0x46,
//! 0x4c,0x41,0x43,0x20,0x31,0x2e,0x31,0x2e,
//! 0x34,0x20,0x32,0x30,0x30,0x37,0x30,0x32,
//! 0x31,0x33,0x04,0x00,0x00,0x00,0x16,0x00,
//! 0x00,0x00,0x74,0x69,0x74,0x6c,0x65,0x3d,
//! 0x32,0x63,0x68,0x20,0x34,0x34,0x31,0x30,
//! 0x30,0x20,0x20,0x31,0x36,0x62,0x69,0x74,
//! 0x10,0x00,0x00,0x00,0x61,0x6c,0x62,0x75,
//! 0x6d,0x3d,0x54,0x65,0x73,0x74,0x20,0x41,
//! 0x6c,0x62,0x75,0x6d,0x0f,0x00,0x00,0x00,
//! 0x61,0x72,0x74,0x69,0x73,0x74,0x3d,0x41,
//! 0x73,0x73,0x6f,0x72,0x74,0x65,0x64,0x0d,
//! 0x00,0x00,0x00,0x74,0x72,0x61,0x63,0x6b,
//! 0x6e,0x75,0x6d,0x62,0x65,0x72,0x3d,0x31];
//!
//! let mut cursor = Cursor::new(&flac);
//!
//! let mut reader = BitReader::endian(&mut cursor, BigEndian);
Expand Down Expand Up @@ -231,7 +232,7 @@ pub trait BitRead {
S: SignedNumeric;

/// Reads a twos-complement signed value from the stream with
/// the given const number of bits.
/// the given constant number of bits.
///
/// # Errors
///
Expand Down

0 comments on commit a13990d

Please sign in to comment.