pub struct StreamingDecoder;Expand description
A streaming GIF decoder that processes frames on-demand.
This decoder is more memory-efficient for large GIFs as it doesn’t need to hold all frames in memory simultaneously. However, it requires maintaining decoder state and is less suitable for random access.
§Example
ⓘ
use figif_core::decoders::StreamingDecoder;
use figif_core::traits::GifDecoder;
let decoder = StreamingDecoder::new();
for frame in decoder.decode_file("large_animation.gif")? {
let frame = frame?;
// Process frame immediately
}Implementations§
Trait Implementations§
Source§impl Clone for StreamingDecoder
impl Clone for StreamingDecoder
Source§fn clone(&self) -> StreamingDecoder
fn clone(&self) -> StreamingDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamingDecoder
impl Debug for StreamingDecoder
Source§impl Default for StreamingDecoder
impl Default for StreamingDecoder
Source§fn default() -> StreamingDecoder
fn default() -> StreamingDecoder
Returns the “default value” for a type. Read more
Source§impl GifDecoder for StreamingDecoder
impl GifDecoder for StreamingDecoder
Source§type FrameIter = StreamingIterWrapper
type FrameIter = StreamingIterWrapper
The type of iterator returned by decode operations.
Source§fn decode_file(&self, path: impl AsRef<Path>) -> Result<Self::FrameIter>
fn decode_file(&self, path: impl AsRef<Path>) -> Result<Self::FrameIter>
Decode a GIF from a file path. Read more
Source§fn decode_bytes(&self, data: &[u8]) -> Result<Self::FrameIter>
fn decode_bytes(&self, data: &[u8]) -> Result<Self::FrameIter>
Decode a GIF from a byte slice. Read more
Source§fn decode_reader<R: Read + Send>(&self, reader: R) -> Result<Self::FrameIter>
fn decode_reader<R: Read + Send>(&self, reader: R) -> Result<Self::FrameIter>
Decode a GIF from any reader. Read more
Source§fn metadata_from_bytes(&self, data: &[u8]) -> Result<GifMetadata>
fn metadata_from_bytes(&self, data: &[u8]) -> Result<GifMetadata>
Extract metadata without fully decoding all frames. Read more
Source§fn metadata_from_file(&self, path: impl AsRef<Path>) -> Result<GifMetadata>
fn metadata_from_file(&self, path: impl AsRef<Path>) -> Result<GifMetadata>
Extract metadata from a file.
Auto Trait Implementations§
impl Freeze for StreamingDecoder
impl RefUnwindSafe for StreamingDecoder
impl Send for StreamingDecoder
impl Sync for StreamingDecoder
impl Unpin for StreamingDecoder
impl UnsafeUnpin for StreamingDecoder
impl UnwindSafe for StreamingDecoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more