Refactor example code in doc comments to use `dynamic_image` instead of `temp_file`Refactor doc comments to use dynamic_image instead of temp_file

This commit is contained in:
Anas Elgarhy 2023-02-24 02:29:19 +02:00
parent eee582a393
commit 8e708796dd
No known key found for this signature in database
GPG Key ID: 0501802A1D496528
1 changed files with 7 additions and 6 deletions

View File

@ -22,15 +22,16 @@ pub mod settings;
///
/// # Example
///
/// ```
/// ```ignore
/// # use image::GenericImageView;
/// # use cmus_notify::get_embedded_art;
/// let result = get_embedded_art("/path/to/track.mp3");
///
/// match result {
/// Ok(Some(temp_file)) => {
/// // Use the temp file...
/// temp_file.path();
/// },
/// Ok(Some(dynamic_image)) => {
/// // Use the image....
/// println!("Track has an embedded picture {dimensions:?}", dimensions = dynamic_image.dimensions());
/// }
/// Ok(None) => println!("Track does not have an embedded picture"),
/// Err(error) => println!("Error: {}", error),
/// }
@ -59,7 +60,7 @@ pub fn get_embedded_art(track_path: &str) -> std::io::Result<Option<image::Dynam
///
/// # Example
///
/// ```
/// ```ignore
/// # use regex::Regex;
/// # use cmus_notify::search_for;
/// let regx = Regex::new(r".\.lrc$").unwrap(); // Match .lrc files