Skip to main content

DecodeBytes

Trait DecodeBytes 

Source
pub trait DecodeBytes {
    // Required method
    fn decode(&self) -> Result<String, EpubError>;
}
Expand description

Provides functionality to decode byte data into strings

This trait is primarily used to decode raw byte data (such as text files read from EPUB files) into a suitable string representation. It supports automatic detection of multiple encoding formats, including UTF-8 (with or without BOM), UTF-16 BE, and UTF-16 LE.

§Implementation

Currently, this trait is implemented for the Vec<u8> type, primarily used for processing text content in EPUB files.

§Notes

  • When attempting to parse a byte stream lacking a BOM (Byte Order Mark), the parsing results may be unreadable; caution should be exercised when using such streams.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DecodeBytes for Vec<u8>

Implementors§