Fix some doc comments

This commit is contained in:
Serial 2022-01-09 09:57:32 -05:00
parent c7aca751e5
commit cefc383123
12 changed files with 29 additions and 30 deletions

View file

@ -54,19 +54,19 @@ macro_rules! impl_accessor {
/// ///
/// ## Item storage /// ## Item storage
/// ///
/// `APE` isn't a very strict format. An [ApeItem] only restricted by its name, meaning it can use /// `APE` isn't a very strict format. An [`ApeItem`] only restricted by its name, meaning it can use
/// a normal [`ItemValue`](crate::ItemValue) unlike other formats. /// a normal [`ItemValue`](crate::ItemValue) unlike other formats.
/// ///
/// Pictures are stored as [`ItemValue::Binary`](crate::ItemValue::Binary), and can be converted with /// Pictures are stored as [`ItemValue::Binary`](crate::ItemValue::Binary), and can be converted with
/// [`Picture::from_ape_bytes`](crate::Picture::from_ape_bytes). For the appropriate item keys, see /// [`Picture::from_ape_bytes`](crate::Picture::from_ape_bytes). For the appropriate item keys, see
/// [APE_PICTURE_TYPES](crate::ape::APE_PICTURE_TYPES). /// [`APE_PICTURE_TYPES`](crate::ape::APE_PICTURE_TYPES).
/// ///
/// ## Conversions /// ## Conversions
/// ///
/// ### From `Tag` /// ### From `Tag`
/// ///
/// When converting pictures, any of type [`PictureType::Undefined`](crate::PictureType::Undefined) will be discarded. /// When converting pictures, any of type [`PictureType::Undefined`](crate::PictureType::Undefined) will be discarded.
/// For items, see [ApeItem::new]. /// For items, see [`ApeItem::new`].
pub struct ApeTag { pub struct ApeTag {
/// Whether or not to mark the tag as read only /// Whether or not to mark the tag as read only
pub read_only: bool, pub read_only: bool,

View file

@ -2,7 +2,7 @@
//! //!
//! # ID3v1 notes //! # ID3v1 notes
//! //!
//! See also: [Id3v1Tag] //! See also: [`Id3v1Tag`]
//! //!
//! ## Genres //! ## Genres
//! //!

View file

@ -19,7 +19,7 @@ pub enum TimestampFormat {
} }
impl TimestampFormat { impl TimestampFormat {
/// Get a TimestampFormat from a u8, must be 1-2 inclusive /// Get a `TimestampFormat` from a u8, must be 1-2 inclusive
pub fn from_u8(byte: u8) -> Option<Self> { pub fn from_u8(byte: u8) -> Option<Self> {
match byte { match byte {
1 => Some(Self::MPEG), 1 => Some(Self::MPEG),
@ -46,7 +46,7 @@ pub enum SyncTextContentType {
} }
impl SyncTextContentType { impl SyncTextContentType {
/// Get a SyncTextContentType from a u8, must be 0-8 inclusive /// Get a `SyncTextContentType` from a u8, must be 0-8 inclusive
pub fn from_u8(byte: u8) -> Option<Self> { pub fn from_u8(byte: u8) -> Option<Self> {
match byte { match byte {
0 => Some(Self::Other), 0 => Some(Self::Other),

View file

@ -4,7 +4,7 @@
//! //!
//! See: //! See:
//! //!
//! * [Id3v2Tag] //! * [`Id3v2Tag`]
//! * [Frame] //! * [Frame]
mod flags; mod flags;

View file

@ -21,7 +21,7 @@ pub enum TextEncoding {
} }
impl TextEncoding { impl TextEncoding {
/// Get a TextEncoding from a u8, must be 0-3 inclusive /// Get a `TextEncoding` from a u8, must be 0-3 inclusive
#[allow(unused)] #[allow(unused)]
pub fn from_u8(byte: u8) -> Option<Self> { pub fn from_u8(byte: u8) -> Option<Self> {
match byte { match byte {

View file

@ -48,10 +48,10 @@ pub struct Comment {
/// ///
/// When converting from [`Tag`](crate::Tag), the following [`ItemKey`](crate::ItemKey)s will be used: /// When converting from [`Tag`](crate::Tag), the following [`ItemKey`](crate::ItemKey)s will be used:
/// ///
/// * [ItemKey::TrackTitle](crate::ItemKey::TrackTitle) /// * [`ItemKey::TrackTitle`](crate::ItemKey::TrackTitle)
/// * [ItemKey::TrackArtist](crate::ItemKey::TrackArtist) /// * [`ItemKey::TrackArtist`](crate::ItemKey::TrackArtist)
/// * [ItemKey::CopyrightMessage](crate::ItemKey::CopyrightMessage) /// * [`ItemKey::CopyrightMessage`](crate::ItemKey::CopyrightMessage)
/// * [ItemKey::Comment](crate::ItemKey::Comment) /// * [`ItemKey::Comment`](crate::ItemKey::Comment)
/// ///
/// When converting [Comment]s, only the `text` field will be preserved. /// When converting [Comment]s, only the `text` field will be preserved.
#[derive(Default, Clone, Debug, PartialEq)] #[derive(Default, Clone, Debug, PartialEq)]

View file

@ -143,7 +143,6 @@
clippy::match_wildcard_for_single_variants, clippy::match_wildcard_for_single_variants,
clippy::semicolon_if_nothing_returned, clippy::semicolon_if_nothing_returned,
clippy::new_without_default, clippy::new_without_default,
clippy::unused_self,
clippy::from_over_into, clippy::from_over_into,
clippy::upper_case_acronyms, clippy::upper_case_acronyms,
clippy::too_many_arguments, clippy::too_many_arguments,

View file

@ -60,16 +60,16 @@ macro_rules! impl_accessor {
/// ## Pictures /// ## Pictures
/// ///
/// Unlike other formats, ilst does not store a [`PictureType`]. All pictures will have /// Unlike other formats, ilst does not store a [`PictureType`]. All pictures will have
/// [PictureType::Other]. /// [`PictureType::Other`].
/// ///
/// ## Conversions /// ## Conversions
/// ///
/// ### To `Tag` /// ### To `Tag`
/// ///
/// When converting to [`Tag`], only atoms with a value of [AtomData::UTF8] and [AtomData::UTF16], as /// When converting to [`Tag`], only atoms with a value of [`AtomData::UTF8`] and [`AtomData::UTF16`], as
/// well as pictures, will be preserved. /// well as pictures, will be preserved.
/// ///
/// Do note, all pictures will be [PictureType::Other](crate::PictureType::Other) /// Do note, all pictures will be [`PictureType::Other`](crate::PictureType::Other)
/// ///
/// ### From `Tag` /// ### From `Tag`
/// ///

View file

@ -56,14 +56,14 @@ pub struct TaggedFile {
impl TaggedFile { impl TaggedFile {
/// Returns the primary tag /// Returns the primary tag
/// ///
/// See [FileType::primary_tag_type] /// See [`FileType::primary_tag_type`]
pub fn primary_tag(&self) -> Option<&Tag> { pub fn primary_tag(&self) -> Option<&Tag> {
self.tag(&self.primary_tag_type()) self.tag(&self.primary_tag_type())
} }
/// Gets a mutable reference to the file's "Primary tag" /// Gets a mutable reference to the file's "Primary tag"
/// ///
/// See [FileType::primary_tag_type] /// See [`FileType::primary_tag_type`]
pub fn primary_tag_mut(&mut self) -> Option<&mut Tag> { pub fn primary_tag_mut(&mut self) -> Option<&mut Tag> {
self.tag_mut(&self.primary_tag_type()) self.tag_mut(&self.primary_tag_type())
} }
@ -71,7 +71,7 @@ impl TaggedFile {
#[allow(unreachable_patterns, clippy::match_same_arms)] #[allow(unreachable_patterns, clippy::match_same_arms)]
/// Returns the file type's primary [`TagType`] /// Returns the file type's primary [`TagType`]
/// ///
/// See [FileType::primary_tag_type] /// See [`FileType::primary_tag_type`]
pub fn primary_tag_type(&self) -> TagType { pub fn primary_tag_type(&self) -> TagType {
self.ty.primary_tag_type() self.ty.primary_tag_type()
} }
@ -141,7 +141,7 @@ impl TaggedFile {
/// ///
/// # Errors /// # Errors
/// ///
/// See [TaggedFile::save_to] /// See [`TaggedFile::save_to`]
pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()> { pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()> {
self.save_to(&mut OpenOptions::new().read(true).write(true).open(path)?) self.save_to(&mut OpenOptions::new().read(true).write(true).open(path)?)
} }
@ -215,7 +215,7 @@ impl FileType {
} }
} }
/// Returns if the target FileType supports a [`TagType`] /// Returns if the target `FileType` supports a [`TagType`]
pub fn supports_tag_type(&self, tag_type: &TagType) -> bool { pub fn supports_tag_type(&self, tag_type: &TagType) -> bool {
match self { match self {
#[cfg(feature = "id3v2")] #[cfg(feature = "id3v2")]

View file

@ -356,7 +356,7 @@ macro_rules! gen_item_keys {
} }
impl ItemKey { impl ItemKey {
/// Map a format specific key to an ItemKey /// Map a format specific key to an `ItemKey`
/// ///
/// NOTE: If used with ID3v2, this will only check against the ID3v2.4 keys. /// NOTE: If used with ID3v2, this will only check against the ID3v2.4 keys.
/// If you wish to use a V2 or V3 key, see [`upgrade_v2`](crate::id3::v2::upgrade_v2) and [`upgrade_v3`](crate::id3::v2::upgrade_v3) /// If you wish to use a V2 or V3 key, see [`upgrade_v2`](crate::id3::v2::upgrade_v2) and [`upgrade_v3`](crate::id3::v2::upgrade_v3)

View file

@ -80,7 +80,7 @@ impl ToString for MimeType {
impl MimeType { impl MimeType {
#[allow(clippy::should_implement_trait)] #[allow(clippy::should_implement_trait)]
/// Get a MimeType from a string /// Get a `MimeType` from a string
pub fn from_str(mime_type: &str) -> Self { pub fn from_str(mime_type: &str) -> Self {
match &*mime_type.to_lowercase() { match &*mime_type.to_lowercase() {
"image/jpeg" => Self::Jpeg, "image/jpeg" => Self::Jpeg,
@ -93,7 +93,7 @@ impl MimeType {
} }
} }
/// Get a &str from a MimeType /// Get a &str from a `MimeType`
pub fn as_str(&self) -> &str { pub fn as_str(&self) -> &str {
match self { match self {
MimeType::Jpeg => "image/jpeg", MimeType::Jpeg => "image/jpeg",
@ -138,7 +138,7 @@ pub enum PictureType {
impl PictureType { impl PictureType {
// ID3/OGG specific methods // ID3/OGG specific methods
/// Get a u8 from a PictureType according to ID3v2 APIC /// Get a u8 from a `PictureType` according to ID3v2 APIC
#[cfg(any(feature = "id3v2", feature = "vorbis_comments"))] #[cfg(any(feature = "id3v2", feature = "vorbis_comments"))]
pub fn as_u8(&self) -> u8 { pub fn as_u8(&self) -> u8 {
match self { match self {
@ -167,7 +167,7 @@ impl PictureType {
} }
} }
/// Get a PictureType from a u8 according to ID3v2 APIC /// Get a `PictureType` from a u8 according to ID3v2 APIC
#[cfg(any(feature = "id3v2", feature = "vorbis_comments"))] #[cfg(any(feature = "id3v2", feature = "vorbis_comments"))]
pub fn from_u8(bytes: u8) -> Self { pub fn from_u8(bytes: u8) -> Self {
match bytes { match bytes {
@ -198,7 +198,7 @@ impl PictureType {
// APE specific methods // APE specific methods
/// Get an APE item key from a PictureType /// Get an APE item key from a `PictureType`
#[cfg(feature = "ape")] #[cfg(feature = "ape")]
pub fn as_ape_key(&self) -> Option<&str> { pub fn as_ape_key(&self) -> Option<&str> {
match self { match self {
@ -227,7 +227,7 @@ impl PictureType {
} }
} }
/// Get a PictureType from an APE item key /// Get a `PictureType` from an APE item key
#[cfg(feature = "ape")] #[cfg(feature = "ape")]
pub fn from_ape_key(key: &str) -> Self { pub fn from_ape_key(key: &str) -> Self {
match key { match key {

View file

@ -59,14 +59,14 @@ macro_rules! impl_accessor {
#[derive(Clone)] #[derive(Clone)]
/// Represents a parsed tag /// Represents a parsed tag
/// ///
/// This is a tag that is loosely bound to a specific [TagType]. /// This is a tag that is loosely bound to a specific [`TagType`].
/// It is used for conversions and as the return type for [`read_from`](crate::read_from). /// It is used for conversions and as the return type for [`read_from`](crate::read_from).
/// ///
/// Compared to other formats, this gives a much higher-level view of the /// Compared to other formats, this gives a much higher-level view of the
/// tag items. Rather than storing items according to their format-specific /// tag items. Rather than storing items according to their format-specific
/// keys, [`ItemKey`]s are used. /// keys, [`ItemKey`]s are used.
/// ///
/// You can easily remap this to another [TagType] with [Tag::re_map]. /// You can easily remap this to another [`TagType`] with [`Tag::re_map`].
/// ///
/// Any conversion will, of course, be lossy to a varying degree. /// Any conversion will, of course, be lossy to a varying degree.
/// ///