pub struct Encoder { /* private fields */ }
Expand description
The Encoder
may be used to encode tags with custom settings.
Implementations
sourceimpl Encoder
impl Encoder
sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new Encoder
with the following configuration:
Version
is ID3v2.4- Unsynchronization is disabled due to compatibility issues
- No compression
- File is not marked as altered
sourcepub fn padding(self, padding: usize) -> Self
pub fn padding(self, padding: usize) -> Self
Sets the padding that is written after the tag.
Should be only used when writing to a MP3 file
sourcepub fn unsynchronisation(self, unsynchronisation: bool) -> Self
pub fn unsynchronisation(self, unsynchronisation: bool) -> Self
Enables or disables the unsynchronisation scheme.
This avoids patterns that resemble MP3-frame headers from being encoded. If you are encoding to MP3 files and wish to be compatible with very old tools, you probably want this enabled.
sourcepub fn compression(self, compression: bool) -> Self
pub fn compression(self, compression: bool) -> Self
Enables or disables compression.
sourcepub fn file_altered(self, file_altered: bool) -> Self
pub fn file_altered(self, file_altered: bool) -> Self
Informs the encoder whether the file this tag belongs to has been changed.
This subsequently discards any tags that have their File Alter Preservation bits set and that have a relation to the file contents:
AENC, ETCO, EQUA, MLLT, POSS, SYLT, SYTC, RVAD, TENC, TLEN, TSIZ
sourcepub fn encode(&self, tag: &Tag, writer: impl Write) -> Result<()>
pub fn encode(&self, tag: &Tag, writer: impl Write) -> Result<()>
Encodes the specified Tag
using the settings set in the Encoder
.
Note that the plain tag is written, regardless of the original contents. To safely encode a
tag to an MP3 file, use Encoder::encode_to_path
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more