Struct ITXtChunk
pub struct ITXtChunk { pub keyword: String, pub compressed: bool, pub language_tag: String, pub translated_keyword: String, /* private fields */ }
Struct encoding an iTXt chunk
Fields
keyword: StringThe keyword field. This needs to be between 1-79 bytes when encoded as Latin-1.
compressed: boolIndicates whether the text will be (or was) compressed in the PNG.
language_tag: StringA hyphen separated list of languages that the keyword is translated to. This is ASCII-7 encoded.
translated_keyword: StringTranslated keyword. This is UTF-8 encoded.
Implementations
impl ITXtChunk
fn new(keyword: impl Into<String>, text: impl Into<String>) -> SelfConstructs a new iTXt chunk. Leaves all but keyword and text to default values.
fn decompress_text(&mut self) -> Result<(), DecodingError>Decompresses the inner text, mutating its own state. Can only handle decompressed text up to
DECOMPRESSION_LIMITbytes.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
limitbytes.fn get_text(&self) -> Result<String, DecodingError>Decompresses the inner text, and returns it as a
String. If decompression takes more than 2 MiB, trydecompress_text_with_limitfollowed by this method.fn compress_text(&mut self) -> Result<(), EncodingError>Compresses the inner text, mutating its own state.
Trait Implementations
impl Clone for ITXtChunk
fn clone(&self) -> Self
impl Debug for ITXtChunk
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl EncodableTextChunk for ITXtChunk
fn encode<W: Write>(&self, w: &mut W) -> Result<(), EncodingError>
impl Eq for ITXtChunk
impl PartialEq for ITXtChunk
fn eq(&self, other: &Self) -> bool
impl StructuralPartialEq for ITXtChunk
Auto Trait Implementations
impl Freeze for ITXtChunk
impl RefUnwindSafe for ITXtChunk
impl Send for ITXtChunk
impl Sync for ITXtChunk
impl Unpin for ITXtChunk
impl UnsafeUnpin for ITXtChunk
impl UnwindSafe for ITXtChunk
Blanket Implementations
impl<T> Any for ITXtChunk
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ITXtChunk
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ITXtChunk
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ITXtChunk
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ITXtChunk
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ITXtChunk
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for ITXtChunk
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ITXtChunk
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ITXtChunk
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>