Function flac::metadata::get_stream_info [] [src]

pub fn get_stream_info(filename: &str) -> Result<StreamInfo>

Reads and returns the StreamInfo metadata block of the given FLAC file.

Failures

  • ErrorKind::NotFound is returned when the given filename isn't found or there is no StreamInfo within the file.
  • ErrorKind::InvalidData is returned when the data within the file isn't valid FLAC data.

Examples

Handling errors might look something like this:

use flac::metadata;

match metadata::get_stream_info("path/to/file.flac") {
  Ok(stream_info) => {
    // Use the stream_info variable...
  }
  Err(error)      => println!("{}", error),
}

Or just ignore the errors:

use flac::metadata;

let stream_info = metadata::get_stream_info("path/to/file.flac").unwrap();