@@ -230,7 +230,7 @@ pub trait Reader: Sized {
230230 fn decode_image ( & mut self , out : & mut [ u8 ] , channels : u8 , src_channels : u8 ) -> Result < ( ) > ;
231231}
232232
233- struct Bytes < ' a > ( & ' a [ u8 ] ) ;
233+ pub struct Bytes < ' a > ( & ' a [ u8 ] ) ;
234234
235235impl < ' a > Bytes < ' a > {
236236 #[ inline]
@@ -318,12 +318,13 @@ impl<R: Read> Decoder<R> {
318318
319319 /// Returns an immutable reference to the underlying reader.
320320 #[ inline]
321- pub fn reader ( & self ) -> & R {
321+ pub const fn reader ( & self ) -> & R {
322322 & self . reader
323323 }
324324
325325 /// Consumes the decoder and returns the underlying reader back.
326326 #[ inline]
327+ #[ allow( clippy:: missing_const_for_fn) ]
327328 pub fn into_reader ( self ) -> R {
328329 self . reader
329330 }
@@ -343,7 +344,7 @@ impl<R: Reader> Decoder<R> {
343344 /// to decode RGB into RGBA (in which case the alpha channel will be set
344345 /// to 255), and vice versa (in which case the alpha channel will be ignored).
345346 #[ inline]
346- pub fn with_channels ( mut self , channels : Channels ) -> Self {
347+ pub const fn with_channels ( mut self , channels : Channels ) -> Self {
347348 self . channels = channels;
348349 self
349350 }
@@ -352,21 +353,21 @@ impl<R: Reader> Decoder<R> {
352353 ///
353354 /// Note: this may differ from the number of channels specified in the header.
354355 #[ inline]
355- pub fn channels ( & self ) -> Channels {
356+ pub const fn channels ( & self ) -> Channels {
356357 self . channels
357358 }
358359
359360 /// Returns the decoded image header.
360361 #[ inline]
361- pub fn header ( & self ) -> & Header {
362+ pub const fn header ( & self ) -> & Header {
362363 & self . header
363364 }
364365
365366 /// The number of bytes the decoded image will take.
366367 ///
367368 /// Can be used to pre-allocate the buffer to decode the image into.
368369 #[ inline]
369- pub fn required_buf_len ( & self ) -> usize {
370+ pub const fn required_buf_len ( & self ) -> usize {
370371 self . header . n_pixels ( ) . saturating_mul ( self . channels . as_u8 ( ) as usize )
371372 }
372373
0 commit comments