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
///
/// `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.
///
/// 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
/// [APE_PICTURE_TYPES](crate::ape::APE_PICTURE_TYPES).
/// [`APE_PICTURE_TYPES`](crate::ape::APE_PICTURE_TYPES).
///
/// ## Conversions
///
/// ### From `Tag`
///
/// 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 {
/// Whether or not to mark the tag as read only
pub read_only: bool,

View file

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

View file

@ -19,7 +19,7 @@ pub enum 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> {
match byte {
1 => Some(Self::MPEG),
@ -46,7 +46,7 @@ pub enum 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> {
match byte {
0 => Some(Self::Other),

View file

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

View file

@ -21,7 +21,7 @@ pub enum 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)]
pub fn from_u8(byte: u8) -> Option<Self> {
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:
///
/// * [ItemKey::TrackTitle](crate::ItemKey::TrackTitle)
/// * [ItemKey::TrackArtist](crate::ItemKey::TrackArtist)
/// * [ItemKey::CopyrightMessage](crate::ItemKey::CopyrightMessage)
/// * [ItemKey::Comment](crate::ItemKey::Comment)
/// * [`ItemKey::TrackTitle`](crate::ItemKey::TrackTitle)
/// * [`ItemKey::TrackArtist`](crate::ItemKey::TrackArtist)
/// * [`ItemKey::CopyrightMessage`](crate::ItemKey::CopyrightMessage)
/// * [`ItemKey::Comment`](crate::ItemKey::Comment)
///
/// When converting [Comment]s, only the `text` field will be preserved.
#[derive(Default, Clone, Debug, PartialEq)]

View file

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

View file

@ -60,16 +60,16 @@ macro_rules! impl_accessor {
/// ## Pictures
///
/// Unlike other formats, ilst does not store a [`PictureType`]. All pictures will have
/// [PictureType::Other].
/// [`PictureType::Other`].
///
/// ## Conversions
///
/// ### 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.
///
/// Do note, all pictures will be [PictureType::Other](crate::PictureType::Other)
/// Do note, all pictures will be [`PictureType::Other`](crate::PictureType::Other)
///
/// ### From `Tag`
///

View file

@ -56,14 +56,14 @@ pub struct TaggedFile {
impl TaggedFile {
/// Returns the primary tag
///
/// See [FileType::primary_tag_type]
/// See [`FileType::primary_tag_type`]
pub fn primary_tag(&self) -> Option<&Tag> {
self.tag(&self.primary_tag_type())
}
/// 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> {
self.tag_mut(&self.primary_tag_type())
}
@ -71,7 +71,7 @@ impl TaggedFile {
#[allow(unreachable_patterns, clippy::match_same_arms)]
/// Returns the file type's primary [`TagType`]
///
/// See [FileType::primary_tag_type]
/// See [`FileType::primary_tag_type`]
pub fn primary_tag_type(&self) -> TagType {
self.ty.primary_tag_type()
}
@ -141,7 +141,7 @@ impl TaggedFile {
///
/// # Errors
///
/// See [TaggedFile::save_to]
/// See [`TaggedFile::save_to`]
pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<()> {
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 {
match self {
#[cfg(feature = "id3v2")]

View file

@ -356,7 +356,7 @@ macro_rules! gen_item_keys {
}
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.
/// 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 {
#[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 {
match &*mime_type.to_lowercase() {
"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 {
match self {
MimeType::Jpeg => "image/jpeg",
@ -138,7 +138,7 @@ pub enum PictureType {
impl PictureType {
// 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"))]
pub fn as_u8(&self) -> u8 {
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"))]
pub fn from_u8(bytes: u8) -> Self {
match bytes {
@ -198,7 +198,7 @@ impl PictureType {
// APE specific methods
/// Get an APE item key from a PictureType
/// Get an APE item key from a `PictureType`
#[cfg(feature = "ape")]
pub fn as_ape_key(&self) -> Option<&str> {
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")]
pub fn from_ape_key(key: &str) -> Self {
match key {

View file

@ -59,14 +59,14 @@ macro_rules! impl_accessor {
#[derive(Clone)]
/// 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).
///
/// Compared to other formats, this gives a much higher-level view of the
/// tag items. Rather than storing items according to their format-specific
/// 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.
///