From c783288f7cebb3f17f43355fda2a8018e143ba70 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 22 Jan 2024 13:22:13 +0000 Subject: [PATCH 1/2] Test comment parsing --- tests/roundtrip.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/roundtrip.rs b/tests/roundtrip.rs index 1baecf1..d8621da 100644 --- a/tests/roundtrip.rs +++ b/tests/roundtrip.rs @@ -1,6 +1,6 @@ #![cfg(feature = "std")] -use gif::{ColorOutput, Decoder, Encoder, Frame}; +use gif::{ColorOutput, Decoder, Encoder, Frame, AnyExtension}; #[test] fn round_trip() { @@ -68,6 +68,7 @@ fn round_trip_from_image(original: &[u8]) { let mut encoder = Encoder::new(vec![], width, height, &global_palette).unwrap(); encoder.set_repeat(repeat).unwrap(); + encoder.write_raw_extension(AnyExtension(gif::Extension::Comment as _), &[b"hello"]).unwrap(); for frame in &frames { encoder.write_frame(frame).unwrap(); } From 55e7c17f0f6ab1579aba199a3ed34010ea21db19 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 22 Jan 2024 13:22:22 +0000 Subject: [PATCH 2/2] Future-proof ExtensionData --- src/encoder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/encoder.rs b/src/encoder.rs index d7c7050..ceb4849 100644 --- a/src/encoder.rs +++ b/src/encoder.rs @@ -93,6 +93,7 @@ impl Default for Repeat { } /// Extension data. +#[non_exhaustive] pub enum ExtensionData { /// Control extension. Use `ExtensionData::new_control_ext` to construct. Control {