Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Introduce WriteOptions #363

Merged
merged 9 commits into from
Apr 3, 2024
Merged

misc: Introduce WriteOptions #363

merged 9 commits into from
Apr 3, 2024

Conversation

Serial-ATA
Copy link
Owner

This allows the caller to tweak how Lofty writes their tags in various ways.

As this is just a dumping ground for all sorts of format-specific settings, this is best used as an application global config that gets set once.

In its current state, it will only respect uppercase_id3v2_chunk and preferred_padding (for some formats).

respect_read_only and remove_others are defined for later use.

closes #228

@@ -0,0 +1,131 @@
/// Options to control how Lofty writes to a file
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this public type copyable could require breaking API changes in the future if it no longer implements Copy. If not needed internally then better remove this derive. Could be added later when it is actually needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the Ord traits don't make any sense to me.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch with Ord. I just copied ParseOptions and renamed it to WriteOptions. Guess I copied it from some other struct. I'll have to remove it from both.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the future if it no longer implements Copy

I really only intend for WriteOptions to be ints and bools just like ParseOptions. Since it's used in generated code in lofty_attr, it'll just be easier to keep it Copy for now.

I'm not too worried about breaking changes at the moment, especially since I have to work on #345 sometime in the near future.

tests/files/mpeg.rs Outdated Show resolved Hide resolved
@Serial-ATA Serial-ATA added this to the 0.19.0 milestone Apr 3, 2024
This allows the caller to tweak how Lofty writes their tags in various ways.

As this is just a dumping ground for all sorts of format-specific settings, this is best used as an application global config that gets set once.

In its current state, it will only respect `uppercase_id3v2_chunk` and `preferred_padding` (for some formats).

`respect_read_only` and `remove_others` are defined for later use.

closes #228
@Serial-ATA Serial-ATA merged commit 17a9261 into main Apr 3, 2024
12 checks passed
@Serial-ATA Serial-ATA deleted the write-options branch April 4, 2024 17:42
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add write options
2 participants