pub struct StreamId(/* private fields */);Expand description
Stream identifier.
Ordinally, the identifier always be set to 0 (the default value).
Implementations§
Source§impl StreamId
impl StreamId
Sourcepub fn new(id: u32) -> Result<Self>
pub fn new(id: u32) -> Result<Self>
Makes a new StreamId instance.
§Errors
If id is greater than 0xFF_FFFF, it will return an ErrorKind::InvalidInput error.
Sourcepub fn value(self) -> u32
pub fn value(self) -> u32
Returns the value of the identifier.
Examples found in repository?
examples/parse.rs (line 35)
11fn main() -> Result<(), MainError> {
12 let stdin = std::io::stdin();
13 let mut input = stdin.lock();
14 let mut buf = ReadBuf::new(vec![0; 1024]);
15 let mut decoder = FileDecoder::new();
16 let mut is_header_shown = false;
17
18 while !buf.stream_state().is_eos() {
19 track!(buf.fill(&mut input))?;
20 track!(decoder.decode_from_read_buf(&mut buf))?;
21 if let Some(h) = decoder.header() {
22 if !is_header_shown {
23 println!("[header]");
24 println!("has_audio = {}", h.has_audio);
25 println!("has_video = {}", h.has_video);
26 println!("");
27 is_header_shown = true;
28 }
29 }
30 if decoder.is_idle() {
31 let tag = track!(decoder.finish_decoding())?;
32 println!("[[tags]]");
33 println!("type = {:?}", tag_type(&tag));
34 println!("timestamp = {}", tag.timestamp().value());
35 println!("stream_id = {}", tag.stream_id().value());
36 println!("");
37 }
38 }
39
40 Ok(())
41}Trait Implementations§
Source§impl Ord for StreamId
impl Ord for StreamId
Source§impl PartialOrd for StreamId
impl PartialOrd for StreamId
impl Copy for StreamId
impl Eq for StreamId
impl StructuralPartialEq for StreamId
Auto Trait Implementations§
impl Freeze for StreamId
impl RefUnwindSafe for StreamId
impl Send for StreamId
impl Sync for StreamId
impl Unpin for StreamId
impl UnwindSafe for StreamId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more