Struct id3::Encoder

source ·
pub struct Encoder { /* private fields */ }
Expand description

The Encoder may be used to encode tags with custom settings.

Implementations§

source§

impl Encoder

source

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
source

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

source

pub fn version(self, version: Version) -> Self

Sets the ID3 version.

source

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.

source

pub fn compression(self, compression: bool) -> Self

Enables or disables compression.

source

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

source

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.

source

pub fn write_to_file(&self, tag: &Tag, file: impl StorageFile) -> Result<()>

Encodes a Tag and replaces any existing tag in the file.

source

pub fn encode_to_file(&self, tag: &Tag, file: &mut File) -> Result<()>

👎Deprecated: Use write_to_file

Encodes a Tag and replaces any existing tag in the file.

source

pub fn write_to_path(&self, tag: &Tag, path: impl AsRef<Path>) -> Result<()>

Encodes a Tag and replaces any existing tag in the file pointed to by the specified path.

source

pub fn encode_to_path(&self, tag: &Tag, path: impl AsRef<Path>) -> Result<()>

👎Deprecated: Use write_to_path

Encodes a Tag and replaces any existing tag in the file pointed to by the specified path.

Trait Implementations§

source§

impl Clone for Encoder

source§

fn clone(&self) -> Encoder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Encoder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Encoder

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.