Merge pull request #318 from image-rs/release-0.11

Fix a couple of nits
This commit is contained in:
Aurelia Molzer authored and GitHub committed 2026-01-05 17:50:30 +00:00
commit 234b2ba677
2 files changed
+14 -8

No files matched your search

+1 -1
View File
@@ -1277,7 +1277,7 @@ impl<R: Read + Seek> Decoder<R> {
/// ///
/// It will re-allocate the buffer into the correct type and size, within the decoder's /// It will re-allocate the buffer into the correct type and size, within the decoder's
/// configured limits, and then pass it to the underlying method. This is essentially a /// configured limits, and then pass it to the underlying method. This is essentially a
/// type-safe wrapper around the raw [`Self::read_chunk_to_bytes`] method. /// type-safe wrapper around the raw [`Self::read_chunk_bytes`] method.
/// ///
/// Note that for planar images each chunk contains only one sample of the underlying data. /// Note that for planar images each chunk contains only one sample of the underlying data.
pub fn read_chunk_to_buffer( pub fn read_chunk_to_buffer(
+13 -7
View File
@@ -20,7 +20,7 @@ macro_rules! tags {
impl $name { impl $name {
#[inline(always)] #[inline(always)]
fn __from_inner_type(n: $ty) -> Result<Self, $ty> { const fn __from_inner_type(n: $ty) -> Result<Self, $ty> {
match n { match n {
$( $val => Ok($name::$tag), )* $( $val => Ok($name::$tag), )*
n => Err(n), n => Err(n),
@@ -28,7 +28,7 @@ macro_rules! tags {
} }
#[inline(always)] #[inline(always)]
fn __to_inner_type(&self) -> $ty { const fn __to_inner_type(&self) -> $ty {
match *self { match *self {
$( $name::$tag => $val, )* $( $name::$tag => $val, )*
$( $name::Unknown($unknown_doc) => { $unknown_doc }, )* $( $name::Unknown($unknown_doc) => { $unknown_doc }, )*
@@ -42,19 +42,25 @@ macro_rules! tags {
($name:tt, u16, $($unknown_doc:ident)*) => { ($name:tt, u16, $($unknown_doc:ident)*) => {
impl $name { impl $name {
#[inline(always)] #[inline(always)]
pub fn from_u16(val: u16) -> Option<Self> { pub const fn from_u16(val: u16) -> Option<Self> {
Self::__from_inner_type(val).ok() match Self::__from_inner_type(val) {
Ok(v) => Some(v),
Err(_) => None,
}
} }
$( $(
#[inline(always)] #[inline(always)]
pub fn from_u16_exhaustive($unknown_doc: u16) -> Self { pub const fn from_u16_exhaustive($unknown_doc: u16) -> Self {
Self::__from_inner_type($unknown_doc).unwrap_or_else(|_| $name::Unknown($unknown_doc)) match Self::__from_inner_type($unknown_doc) {
Ok(v) => v,
Err(_) => $name::Unknown($unknown_doc),
}
} }
)* )*
#[inline(always)] #[inline(always)]
pub fn to_u16(&self) -> u16 { pub const fn to_u16(&self) -> u16 {
Self::__to_inner_type(self) Self::__to_inner_type(self)
} }
} }