doc: Fix a bunch of test imports

This commit is contained in:
Serial 2024-04-13 13:33:54 -04:00 committed by Alex
parent 464f459e99
commit 826e55be23
10 changed files with 129 additions and 105 deletions

View file

@ -299,7 +299,7 @@ impl FileEncodingError {
///
/// ```rust
/// use lofty::error::FileEncodingError;
/// use lofty::FileType;
/// use lofty::file::FileType;
///
/// // This error is bounded to `FileType::Mpeg`, which will be displayed when the error is formatted
/// let mpeg_error =
@ -319,7 +319,7 @@ impl FileEncodingError {
///
/// ```rust
/// use lofty::error::FileEncodingError;
/// use lofty::FileType;
/// use lofty::file::FileType;
///
/// // The error isn't bounded to FileType::Mpeg, only the message will be displayed when the
/// // error is formatted
@ -338,7 +338,7 @@ impl FileEncodingError {
///
/// ```rust
/// use lofty::error::FileEncodingError;
/// use lofty::FileType;
/// use lofty::file::FileType;
///
/// let mpeg_error =
/// FileEncodingError::new(FileType::Mpeg, "Something went wrong in the MPEG file!");
@ -355,7 +355,7 @@ impl FileEncodingError {
///
/// ```rust
/// use lofty::error::FileEncodingError;
/// use lofty::FileType;
/// use lofty::file::FileType;
///
/// let mpeg_error =
/// FileEncodingError::new(FileType::Mpeg, "Something went wrong in the MPEG file!");
@ -401,8 +401,7 @@ impl LoftyError {
/// # Examples
///
/// ```rust
/// use lofty::error::ErrorKind;
/// use lofty::LoftyError;
/// use lofty::error::{ErrorKind, LoftyError};
///
/// let unknown_format = LoftyError::new(ErrorKind::UnknownFormat);
/// ```
@ -416,8 +415,7 @@ impl LoftyError {
/// # Examples
///
/// ```rust
/// use lofty::error::ErrorKind;
/// use lofty::LoftyError;
/// use lofty::error::{ErrorKind, LoftyError};
///
/// let unknown_format = LoftyError::new(ErrorKind::UnknownFormat);
/// if let ErrorKind::UnknownFormat = unknown_format.kind() {

View file

@ -35,9 +35,10 @@ pub trait AudioFile: Into<TaggedFile> {
/// # Examples
///
/// ```rust,no_run
/// use lofty::{AudioFile, TaggedFileExt, WriteOptions};
/// use lofty::config::WriteOptions;
/// use lofty::file::{AudioFile, TaggedFileExt};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// let mut tagged_file = lofty::read_from_path(path)?;
///
@ -63,7 +64,7 @@ pub trait AudioFile: Into<TaggedFile> {
///
/// ```rust,no_run
/// use lofty::config::WriteOptions;
/// use lofty::{AudioFile, TaggedFileExt, WriteOptions};
/// use lofty::file::{AudioFile, TaggedFileExt};
/// use std::fs::OpenOptions;
///
/// # fn main() -> lofty::error::Result<()> {

View file

@ -42,7 +42,8 @@ impl FileType {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, TagType};
/// use lofty::file::FileType;
/// use lofty::TagType;
///
/// let file_type = FileType::Mpeg;
/// assert_eq!(file_type.primary_tag_type(), TagType::Id3v2);
@ -75,7 +76,8 @@ impl FileType {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, TagType};
/// use lofty::file::FileType;
/// use lofty::TagType;
///
/// let file_type = FileType::Mpeg;
/// assert!(file_type.supports_tag_type(TagType::Id3v2));
@ -102,7 +104,7 @@ impl FileType {
/// # Examples
///
/// ```rust
/// use lofty::FileType;
/// use lofty::file::FileType;
///
/// let extension = "mp3";
/// assert_eq!(FileType::from_ext(extension), Some(FileType::Mpeg));
@ -147,7 +149,7 @@ impl FileType {
/// # Examples
///
/// ```rust
/// use lofty::FileType;
/// use lofty::file::FileType;
/// use std::path::Path;
///
/// let path = Path::new("path/to/my.mp3");
@ -175,11 +177,11 @@ impl FileType {
/// # Examples
///
/// ```rust
/// use lofty::FileType;
/// use lofty::file::FileType;
/// use std::fs::File;
/// use std::io::Read;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_opus = "tests/files/assets/minimal/full_test.opus";
/// let mut file = File::open(path_to_opus)?;
///

View file

@ -16,9 +16,9 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, TaggedFileExt};
/// use lofty::file::{FileType, TaggedFileExt};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
///
@ -32,9 +32,9 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, TaggedFileExt};
/// use lofty::file::{FileType, TaggedFileExt};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // An MP3 file with 3 tags
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -53,9 +53,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
///
@ -71,9 +72,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
///
@ -89,9 +91,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file with an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -110,9 +113,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file with an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -135,9 +139,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file with an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -160,9 +165,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{TagType, TaggedFileExt};
/// use lofty::file::TaggedFileExt;
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file with an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -188,9 +194,9 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::TaggedFileExt;
/// use lofty::file::TaggedFileExt;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// // A file we know has tags
/// let mut tagged_file = lofty::read_from_path(path)?;
@ -212,9 +218,9 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::TaggedFileExt;
/// use lofty::file::TaggedFileExt;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// // A file we know has tags
/// let mut tagged_file = lofty::read_from_path(path)?;
@ -238,9 +244,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{AudioFile, Tag, TagType, TaggedFileExt};
/// use lofty::file::{AudioFile, TaggedFileExt};
/// use lofty::{Tag, TagType};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file without an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -262,9 +269,10 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::{AudioFile, TagType, TaggedFileExt};
/// use lofty::file::{AudioFile, TaggedFileExt};
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file containing an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -284,9 +292,9 @@ pub trait TaggedFileExt {
/// # Examples
///
/// ```rust
/// use lofty::TaggedFileExt;
/// use lofty::file::TaggedFileExt;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// let mut tagged_file = lofty::read_from_path(path)?;
///
@ -332,9 +340,10 @@ impl TaggedFile {
/// # Examples
///
/// ```rust
/// use lofty::{AudioFile, FileType, TagType, TaggedFileExt};
/// use lofty::file::{AudioFile, FileType, TaggedFileExt};
/// use lofty::TagType;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path_to_mp3 = "tests/files/assets/minimal/full_test.mp3";
/// // Read an MP3 file containing an ID3v2 tag
/// let mut tagged_file = lofty::read_from_path(path_to_mp3)?;
@ -451,8 +460,10 @@ impl From<BoundTaggedFile> for TaggedFile {
/// For example:
///
/// ```rust,no_run
/// use lofty::{AudioFile, Tag, TagType, TaggedFileExt, WriteOptions};
/// # fn main() -> lofty::Result<()> {
/// use lofty::config::WriteOptions;
/// use lofty::file::{AudioFile, TaggedFileExt};
/// use lofty::{Tag, TagType};
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
///
/// // We create an empty tag
@ -474,11 +485,11 @@ impl From<BoundTaggedFile> for TaggedFile {
/// However, when using `BoundTaggedFile`:
///
/// ```rust,no_run
/// use lofty::{
/// AudioFile, BoundTaggedFile, ParseOptions, Tag, TagType, TaggedFileExt, WriteOptions,
/// };
/// use lofty::config::{ParseOptions, WriteOptions};
/// use lofty::file::{AudioFile, BoundTaggedFile, TaggedFileExt};
/// use lofty::{Tag, TagType};
/// use std::fs::OpenOptions;
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
///
/// // We create an empty tag
@ -514,9 +525,11 @@ impl BoundTaggedFile {
/// # Examples
///
/// ```rust
/// use lofty::{AudioFile, BoundTaggedFile, ParseOptions, Tag, TagType, TaggedFileExt};
/// use lofty::config::ParseOptions;
/// use lofty::file::{AudioFile, BoundTaggedFile, TaggedFileExt};
/// use lofty::{Tag, TagType};
/// use std::fs::OpenOptions;
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
///
/// // We'll need to open our file for reading *and* writing
@ -545,11 +558,11 @@ impl BoundTaggedFile {
/// # Examples
///
/// ```rust,no_run
/// use lofty::{
/// AudioFile, BoundTaggedFile, ParseOptions, Tag, TagType, TaggedFileExt, WriteOptions,
/// };
/// use lofty::config::{ParseOptions, WriteOptions};
/// use lofty::file::{AudioFile, BoundTaggedFile, TaggedFileExt};
/// use lofty::{Tag, TagType};
/// use std::fs::OpenOptions;
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
///
/// // We'll need to open our file for reading *and* writing

View file

@ -16,7 +16,7 @@ use std::io::Read;
/// use std::io::{Cursor, Read};
/// use lofty::id3::v2::util::synchsafe::UnsynchronizedStream;
///
/// fn main() -> lofty::Result<()> {
/// fn main() -> lofty::error::Result<()> {
/// // The content has two `0xFF 0x00` pairs, which will be removed
/// let content = [0xFF, 0x00, 0x1A, 0xFF, 0x00, 0x15];
///
@ -68,7 +68,7 @@ impl<R> UnsynchronizedStream<R> {
/// use lofty::id3::v2::util::synchsafe::UnsynchronizedStream;
/// use std::io::Cursor;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// let reader = Cursor::new([0xFF, 0x00, 0x1A]);
/// let unsynchronized_reader = UnsynchronizedStream::new(reader);
///

View file

@ -16,8 +16,7 @@
//! ### Using a path
//!
//! ```rust,no_run
//! # use lofty::LoftyError;
//! # fn main() -> Result<(), LoftyError> {
//! # fn main() -> lofty::error::Result<()> {
//! use lofty::{read_from_path, Probe};
//!
//! // This will guess the format from the extension
@ -35,9 +34,9 @@
//! ### Using an existing reader
//!
//! ```rust,no_run
//! # use lofty::LoftyError;
//! # fn main() -> Result<(), LoftyError> {
//! use lofty::{read_from, ParseOptions};
//! # fn main() -> lofty::error::Result<()> {
//! use lofty::config::ParseOptions;
//! use lofty::read_from;
//! use std::fs::File;
//!
//! // Let's read from an open file
@ -53,9 +52,9 @@
//! ### Accessing tags
//!
//! ```rust,no_run
//! # use lofty::LoftyError;
//! # fn main() -> Result<(), LoftyError> {
//! use lofty::{read_from_path, ParseOptions, TaggedFileExt};
//! # fn main() -> lofty::error::Result<()> {
//! use lofty::file::TaggedFileExt;
//! use lofty::read_from_path;
//!
//! let path = "test.mp3";
//! let tagged_file = read_from_path(path)?;
@ -73,10 +72,11 @@
//! ## Using concrete file types
//!
//! ```rust
//! # use lofty::LoftyError;
//! # fn main() -> Result<(), LoftyError> {
//! # fn main() -> lofty::error::Result<()> {
//! use lofty::config::ParseOptions;
//! use lofty::file::AudioFile;
//! use lofty::mpeg::MpegFile;
//! use lofty::{AudioFile, ParseOptions, TagType};
//! use lofty::TagType;
//! use std::fs::File;
//!
//! # let path = "tests/files/assets/minimal/full_test.mp3";

View file

@ -179,7 +179,7 @@ impl<'a> Atom<'a> {
/// ```rust
/// use lofty::mp4::{Atom, AtomData, AtomIdent};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// // Create an artist atom
/// let mut atom = Atom::new(
/// AtomIdent::Fourcc(*b"\x49ART"),

View file

@ -47,10 +47,11 @@ impl Mp4File {
/// # Examples
///
/// ```rust,no_run
/// use lofty::config::ParseOptions;
/// use lofty::file::AudioFile;
/// use lofty::mp4::Mp4File;
/// use lofty::{AudioFile, ParseOptions};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let mut m4a_reader = std::io::Cursor::new(&[]);
/// let m4a_file = Mp4File::read_from(&mut m4a_reader, ParseOptions::new())?;
///

View file

@ -73,7 +73,7 @@ pub trait OggPictureStorage: private::Sealed {
/// use lofty::ogg::{VorbisComments, OggPictureStorage};
/// # use lofty::{Picture, PictureInformation, PictureType, MimeType};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let front_cover = Picture::new_unchecked(PictureType::CoverFront, Some(MimeType::Png), None, Vec::new());
/// # let front_cover_info = PictureInformation::default();
/// # let back_cover = Picture::new_unchecked(PictureType::CoverBack, Some(MimeType::Png), None, Vec::new());
@ -121,7 +121,7 @@ pub trait OggPictureStorage: private::Sealed {
/// use lofty::ogg::{VorbisComments, OggPictureStorage};
/// # use lofty::{Picture, PictureType, MimeType, PictureInformation};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let front_cover = Picture::new_unchecked(PictureType::CoverFront, Some(MimeType::Png), None, Vec::new());
/// # let front_cover_info = PictureInformation::default();
/// let mut tag = VorbisComments::default();
@ -148,7 +148,7 @@ pub trait OggPictureStorage: private::Sealed {
/// use lofty::ogg::{VorbisComments, OggPictureStorage};
/// # use lofty::{Picture, PictureType, MimeType, PictureInformation};
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let front_cover = Picture::new_unchecked(PictureType::CoverFront, Some(MimeType::Png), None, Vec::new());
/// # let front_cover_info = PictureInformation::default();
/// # let back_cover = Picture::new_unchecked(PictureType::CoverBack, Some(MimeType::Png), None, Vec::new());

View file

@ -32,9 +32,9 @@ use std::path::Path;
/// open file.
///
/// ```rust,no_run
/// # use lofty::{LoftyError, Probe};
/// # fn main() -> Result<(), LoftyError> {
/// use lofty::FileType;
/// # fn main() -> lofty::error::Result<()> {
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// let probe = Probe::open("path/to/my.mp3")?;
///
@ -47,9 +47,9 @@ use std::path::Path;
/// When a path isn't available, or is unreliable, content-based detection is also possible.
///
/// ```rust,no_run
/// # use lofty::{LoftyError, Probe};
/// # fn main() -> Result<(), LoftyError> {
/// use lofty::FileType;
/// # fn main() -> lofty::error::Result<()> {
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// // Our same path probe with a guessed file type
/// let probe = Probe::open("path/to/my.mp3")?.guess_file_type()?;
@ -63,9 +63,9 @@ use std::path::Path;
/// Or with another reader
///
/// ```rust
/// # use lofty::{LoftyError, Probe};
/// # fn main() -> Result<(), LoftyError> {
/// use lofty::FileType;
/// # fn main() -> lofty::error::Result<()> {
/// use lofty::file::FileType;
/// use lofty::Probe;
/// use std::io::Cursor;
///
/// static MAC_HEADER: &[u8; 3] = b"MAC";
@ -96,7 +96,7 @@ impl<R: Read> Probe<R> {
/// use std::fs::File;
/// use std::io::BufReader;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// let file = File::open(path)?;
/// let reader = BufReader::new(file);
@ -121,11 +121,12 @@ impl<R: Read> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
/// use std::fs::File;
/// use std::io::BufReader;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let my_mp3_path = "tests/files/assets/minimal/full_test.mp3";
/// // We know the file is going to be an MP3,
/// // so we can skip the format detection
@ -148,9 +149,10 @@ impl<R: Read> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let reader = std::io::Cursor::new(&[]);
/// let probe = Probe::new(reader);
///
@ -166,9 +168,10 @@ impl<R: Read> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let reader = std::io::Cursor::new(&[]);
/// let mut probe = Probe::new(reader);
/// assert_eq!(probe.file_type(), None);
@ -188,9 +191,10 @@ impl<R: Read> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{ParseOptions, Probe};
/// use lofty::config::ParseOptions;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let reader = std::io::Cursor::new(&[]);
/// // By default, properties will be read.
/// // In this example, we want to turn this off.
@ -210,9 +214,10 @@ impl<R: Read> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let reader = std::io::Cursor::new(&[]);
/// let probe = Probe::new(reader);
///
@ -237,9 +242,10 @@ impl Probe<BufReader<File>> {
/// # Examples
///
/// ```rust,no_run
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// let probe = Probe::open("path/to/my.mp3")?;
///
/// // Guessed from the "mp3" extension, see `FileType::from_ext`
@ -282,9 +288,10 @@ impl<R: Read + Seek> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// # let file = std::fs::File::open(path)?;
/// # let reader = std::io::BufReader::new(file);
@ -434,9 +441,10 @@ impl<R: Read + Seek> Probe<R> {
/// # Examples
///
/// ```rust
/// use lofty::{FileType, Probe};
/// use lofty::file::FileType;
/// use lofty::Probe;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// # let file = std::fs::File::open(path)?;
/// # let reader = std::io::BufReader::new(file);
@ -492,7 +500,7 @@ impl<R: Read + Seek> Probe<R> {
/// use lofty::read_from;
/// use std::fs::File;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// let mut file = File::open(path)?;
///
@ -519,7 +527,7 @@ pub fn read_from(file: &mut File) -> Result<TaggedFile> {
/// ```rust
/// use lofty::read_from_path;
///
/// # fn main() -> lofty::Result<()> {
/// # fn main() -> lofty::error::Result<()> {
/// # let path = "tests/files/assets/minimal/full_test.mp3";
/// let parsed_file = read_from_path(path)?;
/// # Ok(()) }
@ -534,7 +542,8 @@ where
#[cfg(test)]
mod tests {
use crate::config::{GlobalOptions, ParseOptions};
use crate::{FileType, Probe};
use crate::file::FileType;
use crate::Probe;
use std::fs::File;