Skip to content

Commit 163d7f4

Browse files
Accessor: Document lack of multi-value support
Co-authored-by: Serial <[email protected]> Signed-off-by: Serial <[email protected]>
1 parent 2ce196f commit 163d7f4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lofty/src/tag/accessor.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ macro_rules! accessor_trait {
2626
///
2727
/// This attempts to only provide methods for items that all tags have in common,
2828
/// but there may be exceptions.
29+
///
30+
/// Note that for tag formats supporting multiple values, the behavior of any setter methods is
31+
/// to **overwrite**, not append. If multi-value support is needed, consider using the format-specific methods.
32+
/// For example: [`Tag::push()`] or [`VorbisComments::push()`].
2933
pub trait Accessor {
3034
$(
3135
accessor_trait! { @GETTER [$($name)+] $($ty),+ }
@@ -53,7 +57,13 @@ macro_rules! accessor_trait {
5357
};
5458
(@GET_METHOD [$name:tt $($other:tt)*] Option<$ret_ty:ty>) => {
5559
paste::paste! {
56-
#[doc = "Returns the " $name $(" " $other)*]
60+
#[doc = "Returns the " $name $(" " $other)* "."]
61+
///
62+
/// For formats that support multiple definitions of the same item, this will only return the first occurrence.
63+
///
64+
/// To retrieve all occurrences of a given item, consider using the format-specific methods.
65+
/// For example: [`Tag::get_items()`] or [`VorbisComments::get_all()`].
66+
///
5767
/// # Example
5868
///
5969
/// ```rust
@@ -70,7 +80,14 @@ macro_rules! accessor_trait {
7080
};
7181
(@SET_METHOD [$name:tt $($other:tt)*] $owned_ty:ty) => {
7282
paste::paste! {
73-
#[doc = "Sets the " $name $(" " $other)*]
83+
#[doc = "Sets the " $name $(" " $other)* "."]
84+
///
85+
/// For formats that support multiple definitions of the same item, this will remove **all**
86+
/// existing values, and replace them with `value`.
87+
///
88+
/// To define multiple values, consider using the format-specific methods.
89+
/// For example: [`Tag::push()`] or [`VorbisComments::push()`].
90+
///
7491
/// # Example
7592
///
7693
/// ```rust,ignore

0 commit comments

Comments
 (0)