Skip to content

Commit 0b2d82b

Browse files
committed
probe: Make module public, remove re-exports
1 parent 6da7555 commit 0b2d82b

File tree

19 files changed

+41
-37
lines changed

19 files changed

+41
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
- `TagItem`
3636
- `ItemKey`
3737
- `ItemValue`
38+
- **Probe**:
39+
- ⚠️ Important ⚠️- Moved to `lofty::probe` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/374)):
3840
- **Picture**:
3941
- ⚠️ Important ⚠️- The following items have been moved to `lofty::picture` ([PR](https://github.com/Serial-ATA/lofty-rs/pull/374)):
4042
- `Picture`

examples/tag_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use lofty::prelude::*;
2-
use lofty::Probe;
2+
use lofty::probe::Probe;
33

44
use std::path::Path;
55

examples/tag_stripper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use lofty::file::TaggedFileExt;
2-
use lofty::Probe;
2+
use lofty::probe::Probe;
33

44
use std::io::Write;
55

examples/tag_writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use lofty::config::WriteOptions;
22
use lofty::prelude::*;
3+
use lofty::probe::Probe;
34
use lofty::tag::Tag;
4-
use lofty::Probe;
55

66
use structopt::StructOpt;
77

src/config/parse_options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ impl ParseOptions {
102102

103103
/// The parsing strictness mode
104104
///
105-
/// This can be set with [`Probe::options`](crate::Probe).
105+
/// This can be set with [`Probe::options`](crate::probe::Probe).
106106
///
107107
/// # Examples
108108
///
109109
/// ```rust,no_run
110110
/// use lofty::config::{ParseOptions, ParsingMode};
111-
/// use lofty::Probe;
111+
/// use lofty::probe::Probe;
112112
///
113113
/// # fn main() -> lofty::error::Result<()> {
114114
/// // We only want to read spec-compliant inputs

src/file/file_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl FileType {
172172
/// * This **will not** search past tags at the start of the buffer.
173173
/// For this behavior, use [`Probe::guess_file_type`].
174174
///
175-
/// [`Probe::guess_file_type`]: crate::Probe::guess_file_type
175+
/// [`Probe::guess_file_type`]: crate::probe::Probe::guess_file_type
176176
///
177177
/// # Examples
178178
///

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
//!
1818
//! ```rust,no_run
1919
//! # fn main() -> lofty::error::Result<()> {
20-
//! use lofty::{read_from_path, Probe};
20+
//! use lofty::probe::Probe;
21+
//! use lofty::read_from_path;
2122
//!
2223
//! // This will guess the format from the extension
2324
//! // ("mp3" in this case), but we can guess from the content if we want to.
@@ -155,7 +156,7 @@ pub mod error;
155156
pub mod file;
156157
pub(crate) mod macros;
157158
pub mod picture;
158-
mod probe;
159+
pub mod probe;
159160
pub mod properties;
160161
pub mod resolve;
161162
pub mod tag;
@@ -172,7 +173,7 @@ pub mod musepack;
172173
pub mod ogg;
173174
pub mod wavpack;
174175

175-
pub use crate::probe::{read_from, read_from_path, Probe};
176+
pub use crate::probe::{read_from, read_from_path};
176177

177178
pub use util::text::TextEncoding;
178179

@@ -187,7 +188,6 @@ pub mod prelude {
187188
//! use lofty::prelude::*;
188189
//! ```
189190
190-
pub use crate::error::LoftyError;
191191
pub use crate::file::{AudioFile, TaggedFileExt};
192192
pub use crate::tag::{Accessor, ItemKey, MergeTag, SplitTag, TagExt};
193193
}

src/probe.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Format-agonostic file parsing tools
2+
13
use crate::aac::AacFile;
24
use crate::ape::ApeFile;
35
use crate::config::{global_options, ParseOptions};
@@ -34,7 +36,7 @@ use std::path::Path;
3436
/// ```rust,no_run
3537
/// # fn main() -> lofty::error::Result<()> {
3638
/// use lofty::file::FileType;
37-
/// use lofty::Probe;
39+
/// use lofty::probe::Probe;
3840
///
3941
/// let probe = Probe::open("path/to/my.mp3")?;
4042
///
@@ -49,7 +51,7 @@ use std::path::Path;
4951
/// ```rust,no_run
5052
/// # fn main() -> lofty::error::Result<()> {
5153
/// use lofty::file::FileType;
52-
/// use lofty::Probe;
54+
/// use lofty::probe::Probe;
5355
///
5456
/// // Our same path probe with a guessed file type
5557
/// let probe = Probe::open("path/to/my.mp3")?.guess_file_type()?;
@@ -65,7 +67,7 @@ use std::path::Path;
6567
/// ```rust
6668
/// # fn main() -> lofty::error::Result<()> {
6769
/// use lofty::file::FileType;
68-
/// use lofty::Probe;
70+
/// use lofty::probe::Probe;
6971
/// use std::io::Cursor;
7072
///
7173
/// static MAC_HEADER: &[u8; 3] = b"MAC";
@@ -86,13 +88,13 @@ pub struct Probe<R: Read> {
8688
impl<R: Read> Probe<R> {
8789
/// Create a new `Probe`
8890
///
89-
/// Before creating a `Probe`, consider wrapping it in a [`BufReader`](std::io::BufReader) for better
91+
/// Before creating a `Probe`, consider wrapping it in a [`BufReader`] for better
9092
/// performance.
9193
///
9294
/// # Examples
9395
///
9496
/// ```rust
95-
/// use lofty::Probe;
97+
/// use lofty::probe::Probe;
9698
/// use std::fs::File;
9799
/// use std::io::BufReader;
98100
///
@@ -115,14 +117,14 @@ impl<R: Read> Probe<R> {
115117

116118
/// Create a new `Probe` with a specified [`FileType`]
117119
///
118-
/// Before creating a `Probe`, consider wrapping it in a [`BufReader`](std::io::BufReader) for better
120+
/// Before creating a `Probe`, consider wrapping it in a [`BufReader`] for better
119121
/// performance.
120122
///
121123
/// # Examples
122124
///
123125
/// ```rust
124126
/// use lofty::file::FileType;
125-
/// use lofty::Probe;
127+
/// use lofty::probe::Probe;
126128
/// use std::fs::File;
127129
/// use std::io::BufReader;
128130
///
@@ -150,7 +152,7 @@ impl<R: Read> Probe<R> {
150152
///
151153
/// ```rust
152154
/// use lofty::file::FileType;
153-
/// use lofty::Probe;
155+
/// use lofty::probe::Probe;
154156
///
155157
/// # fn main() -> lofty::error::Result<()> {
156158
/// # let reader = std::io::Cursor::new(&[]);
@@ -169,7 +171,7 @@ impl<R: Read> Probe<R> {
169171
///
170172
/// ```rust
171173
/// use lofty::file::FileType;
172-
/// use lofty::Probe;
174+
/// use lofty::probe::Probe;
173175
///
174176
/// # fn main() -> lofty::error::Result<()> {
175177
/// # let reader = std::io::Cursor::new(&[]);
@@ -192,7 +194,7 @@ impl<R: Read> Probe<R> {
192194
///
193195
/// ```rust
194196
/// use lofty::config::ParseOptions;
195-
/// use lofty::Probe;
197+
/// use lofty::probe::Probe;
196198
///
197199
/// # fn main() -> lofty::error::Result<()> {
198200
/// # let reader = std::io::Cursor::new(&[]);
@@ -215,7 +217,7 @@ impl<R: Read> Probe<R> {
215217
///
216218
/// ```rust
217219
/// use lofty::file::FileType;
218-
/// use lofty::Probe;
220+
/// use lofty::probe::Probe;
219221
///
220222
/// # fn main() -> lofty::error::Result<()> {
221223
/// # let reader = std::io::Cursor::new(&[]);
@@ -243,7 +245,7 @@ impl Probe<BufReader<File>> {
243245
///
244246
/// ```rust,no_run
245247
/// use lofty::file::FileType;
246-
/// use lofty::Probe;
248+
/// use lofty::probe::Probe;
247249
///
248250
/// # fn main() -> lofty::error::Result<()> {
249251
/// let probe = Probe::open("path/to/my.mp3")?;
@@ -289,7 +291,7 @@ impl<R: Read + Seek> Probe<R> {
289291
///
290292
/// ```rust
291293
/// use lofty::file::FileType;
292-
/// use lofty::Probe;
294+
/// use lofty::probe::Probe;
293295
///
294296
/// # fn main() -> lofty::error::Result<()> {
295297
/// # let path = "tests/files/assets/minimal/full_test.mp3";
@@ -442,7 +444,7 @@ impl<R: Read + Seek> Probe<R> {
442444
///
443445
/// ```rust
444446
/// use lofty::file::FileType;
445-
/// use lofty::Probe;
447+
/// use lofty::probe::Probe;
446448
///
447449
/// # fn main() -> lofty::error::Result<()> {
448450
/// # let path = "tests/files/assets/minimal/full_test.mp3";
@@ -543,7 +545,7 @@ where
543545
mod tests {
544546
use crate::config::{GlobalOptions, ParseOptions};
545547
use crate::file::FileType;
546-
use crate::Probe;
548+
use crate::probe::Probe;
547549

548550
use std::fs::File;
549551

src/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::sync::{Arc, Mutex, OnceLock};
1515
///
1616
/// This trait allows for the creation of custom [`FileType`]s, that can make use of
1717
/// lofty's API. Registering a `FileResolver` ([`register_custom_resolver`]) makes it possible
18-
/// to detect and read files using [`Probe`](crate::Probe).
18+
/// to detect and read files using [`Probe`](crate::probe::Probe).
1919
pub trait FileResolver: Send + Sync + AudioFile {
2020
/// The extension associated with the [`FileType`] without the '.'
2121
fn extension() -> Option<&'static str>;

tests/files/aac.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/aiff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/ape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/mp4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/mpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use lofty::config::ParseOptions;
33
use lofty::file::{FileType, TaggedFile};
44
use lofty::musepack::MpcFile;
55
use lofty::prelude::*;
6+
use lofty::probe::Probe;
67
use lofty::tag::TagType;
7-
use lofty::Probe;
88

99
use std::io::{Seek, Write};
1010

tests/files/mpeg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use lofty::file::FileType;
44
use lofty::id3::v2::{Frame, FrameFlags, FrameId, FrameValue, Id3v2Tag, KeyValueFrame};
55
use lofty::mpeg::MpegFile;
66
use lofty::prelude::*;
7+
use lofty::probe::Probe;
78
use lofty::tag::{Tag, TagType};
8-
use lofty::Probe;
99

1010
use std::borrow::Cow;
1111
use std::io::{Seek, Write};

tests/files/ogg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::{ParseOptions, WriteOptions};
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/util/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ macro_rules! remove_tag {
7979
($path:tt, $tag_type:path) => {
8080
let mut file = temp_file!($path);
8181

82-
let tagged_file = lofty::Probe::new(&mut file)
82+
let tagged_file = lofty::probe::Probe::new(&mut file)
8383
.options(lofty::config::ParseOptions::new().read_properties(false))
8484
.guess_file_type()
8585
.unwrap()
@@ -93,7 +93,7 @@ macro_rules! remove_tag {
9393

9494
file.rewind().unwrap();
9595

96-
let tagged_file = lofty::Probe::new(&mut file)
96+
let tagged_file = lofty::probe::Probe::new(&mut file)
9797
.options(lofty::config::ParseOptions::new().read_properties(false))
9898
.guess_file_type()
9999
.unwrap()

tests/files/wav.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

tests/files/wavpack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::{set_artist, temp_file, verify_artist};
22
use lofty::config::ParseOptions;
33
use lofty::file::FileType;
44
use lofty::prelude::*;
5+
use lofty::probe::Probe;
56
use lofty::tag::TagType;
6-
use lofty::Probe;
77

88
use std::io::{Seek, Write};
99

0 commit comments

Comments
 (0)