Struct png::text_metadata::ZTXtChunk
source · pub struct ZTXtChunk {
pub keyword: String,
/* private fields */
}
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.
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.
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.