Refactor example code in doc comments to use dynamic_image instead of temp_fileRefactor 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

View file

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