Struct png::text_metadata::ZTXtChunk
source · pub struct ZTXtChunk {
pub keyword: String,
text: OptCompressed,
}
Expand description
Struct representing a zTXt chunk
Fields§
§keyword: String
Keyword field of the tEXt chunk. Needs to be between 1-79 bytes when encoded as Latin-1.
text: OptCompressed
Text field of zTXt chunk. It is compressed by default, but can be uncompressed if necessary.
Implementations§
source§impl ZTXtChunk
impl ZTXtChunk
sourcepub fn new(keyword: impl Into<String>, text: impl Into<String>) -> Self
pub fn new(keyword: impl Into<String>, text: impl Into<String>) -> Self
Creates a new ZTXt chunk.
pub(crate) fn decode( keyword_slice: &[u8], compression_method: u8, text_slice: &[u8], ) -> Result<Self, TextDecodingError>
sourcepub fn decompress_text(&mut self) -> Result<(), DecodingError>
pub fn decompress_text(&mut self) -> Result<(), DecodingError>
Decompresses the inner text, mutating its own state. Can only handle decompressed text up to DECOMPRESSION_LIMIT
bytes.
sourcepub fn decompress_text_with_limit(
&mut self,
limit: usize,
) -> Result<(), DecodingError>
pub fn decompress_text_with_limit( &mut self, limit: usize, ) -> Result<(), DecodingError>
Decompresses the inner text, mutating its own state. Can only handle decompressed text up to limit
bytes.
sourcepub fn get_text(&self) -> Result<String, DecodingError>
pub fn get_text(&self) -> Result<String, DecodingError>
Decompresses the inner text, and returns it as a String
.
If decompression uses more the 2MiB, first call decompress with limit, and then this method.
sourcepub fn compress_text(&mut self) -> Result<(), EncodingError>
pub fn compress_text(&mut self) -> Result<(), EncodingError>
Compresses the inner text, mutating its own state.
Trait Implementations§
source§impl EncodableTextChunk for ZTXtChunk
impl EncodableTextChunk for ZTXtChunk
source§impl PartialEq for ZTXtChunk
impl PartialEq for ZTXtChunk
impl Eq for ZTXtChunk
impl StructuralPartialEq for ZTXtChunk
Auto Trait Implementations§
impl Freeze for ZTXtChunk
impl RefUnwindSafe for ZTXtChunk
impl Send for ZTXtChunk
impl Sync for ZTXtChunk
impl Unpin for ZTXtChunk
impl UnwindSafe for ZTXtChunk
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more