Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/codecs/gif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ impl<W: Write> GifEncoder<W> {
}

/// Create a new GIF encoder, and has the speed parameter `speed`. See
/// [`Frame::from_rgba_speed`](https://docs.rs/gif/latest/gif/struct.Frame.html#method.from_rgba_speed)
/// for more information.
/// [`Frame::from_rgba_speed`] for more information.
pub fn new_with_speed(w: W, speed: i32) -> GifEncoder<W> {
assert!(
(1..=30).contains(&speed),
Expand Down
3 changes: 0 additions & 3 deletions src/codecs/png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@ impl<R: BufRead + Seek> ImageDecoder for PngDecoder<R> {
/// An animated adapter of [`PngDecoder`].
///
/// See [`PngDecoder::apng`] for more information.
///
/// [`PngDecoder`]: struct.PngDecoder.html
/// [`PngDecoder::apng`]: struct.PngDecoder.html#method.apng
pub struct ApngDecoder<R: BufRead + Seek> {
inner: PngDecoder<R>,
/// The current output buffer.
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/pnm/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum DecoderError {
HeaderLineUnknown(String),
/// At least one of the required lines were missing from the header (are `None` here)
///
/// Same names as [`PnmHeaderLine`](enum.PnmHeaderLine.html)
/// Same names as [`PnmHeaderLine`]
#[allow(missing_docs)]
HeaderLineMissing {
height: Option<u32>,
Expand Down
15 changes: 2 additions & 13 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//! `image` does not promise to remain on a particular version of its underlying decoders but if
//! you ensure to use the same version of the dependency (or at least of the error type) through
//! external means then you could inspect the error type in slightly more detail.
//!
//! [`ImageError`]: enum.ImageError.html

use std::collections::TryReserveError;
use std::error::Error;
Expand Down Expand Up @@ -67,9 +65,8 @@ pub enum ImageError {

/// The implementation for an operation was not provided.
///
/// See the variant [`Unsupported`] for more documentation.
///
/// [`Unsupported`]: enum.ImageError.html#variant.Unsupported
/// This is used as an opaque representation for the [`ImageError::Unsupported`] variant. See its
/// documentation for more information.
#[derive(Debug)]
pub struct UnsupportedError {
format: ImageFormatHint,
Expand Down Expand Up @@ -97,8 +94,6 @@ pub enum UnsupportedErrorKind {
///
/// This is used as an opaque representation for the [`ImageError::Encoding`] variant. See its
/// documentation for more information.
///
/// [`ImageError::Encoding`]: enum.ImageError.html#variant.Encoding
#[derive(Debug)]
pub struct EncodingError {
format: ImageFormatHint,
Expand All @@ -109,8 +104,6 @@ pub struct EncodingError {
///
/// This is used as an opaque representation for the [`ImageError::Parameter`] variant. See its
/// documentation for more information.
///
/// [`ImageError::Parameter`]: enum.ImageError.html#variant.Parameter
#[derive(Debug)]
pub struct ParameterError {
kind: ParameterErrorKind,
Expand Down Expand Up @@ -147,8 +140,6 @@ pub enum ParameterErrorKind {
///
/// This is used as an opaque representation for the [`ImageError::Decoding`] variant. See its
/// documentation for more information.
///
/// [`ImageError::Decoding`]: enum.ImageError.html#variant.Decoding
#[derive(Debug)]
pub struct DecodingError {
format: ImageFormatHint,
Expand All @@ -159,8 +150,6 @@ pub struct DecodingError {
///
/// This is used as an opaque representation for the [`ImageError::Limits`] variant. See its
/// documentation for more information.
///
/// [`ImageError::Limits`]: enum.ImageError.html#variant.Limits
#[derive(Debug)]
pub struct LimitError {
kind: LimitErrorKind,
Expand Down
16 changes: 3 additions & 13 deletions src/images/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ use crate::{DynamicImage, GenericImage, GenericImageView, ImageEncoder, ImageFor
/// Iterate over rows of an image
///
/// This iterator is created with [`ImageBuffer::rows`]. See its document for details.
///
/// [`ImageBuffer::rows`]: ../struct.ImageBuffer.html#method.rows
pub struct Rows<'a, P: Pixel + 'a> {
pixels: ChunksExact<'a, P>,
}
Expand Down Expand Up @@ -109,8 +107,6 @@ where
/// Iterate over mutable rows of an image
///
/// This iterator is created with [`ImageBuffer::rows_mut`]. See its document for details.
///
/// [`ImageBuffer::rows_mut`]: ../struct.ImageBuffer.html#method.rows_mut
pub struct RowsMut<'a, P: Pixel + 'a> {
pixels: ChunksExactMut<'a, P>,
}
Expand Down Expand Up @@ -453,20 +449,14 @@ where
/// The crate defines a few type aliases with regularly used pixel types for your convenience, such
/// as [`RgbImage`], [`GrayImage`] etc.
///
/// [`GenericImage`]: trait.GenericImage.html
/// [`GenericImageView`]: trait.GenericImageView.html
/// [`RgbImage`]: type.RgbImage.html
/// [`GrayImage`]: type.GrayImage.html
///
/// To convert between images of different Pixel types use [`DynamicImage`].
///
/// You can retrieve a complete description of the buffer's layout and contents through
/// [`as_flat_samples`] and [`as_flat_samples_mut`]. This can be handy to also use the contents in
/// a foreign language, map it as a GPU host buffer or other similar tasks.
///
/// [`DynamicImage`]: enum.DynamicImage.html
/// [`as_flat_samples`]: #method.as_flat_samples
/// [`as_flat_samples_mut`]: #method.as_flat_samples_mut
/// [`as_flat_samples`]: Self::as_flat_samples
/// [`as_flat_samples_mut`]: Self::as_flat_samples_mut
///
/// ## Examples
///
Expand Down Expand Up @@ -1027,7 +1017,7 @@ where
/// Saves the buffer to a file at the specified path in
/// the specified format.
///
/// See [`save_buffer_with_format`](fn.save_buffer_with_format.html) for
/// See [`save_buffer_with_format`](crate::save_buffer_with_format) for
/// supported types.
pub fn save_with_format<Q>(&self, path: Q, format: ImageFormat) -> ImageResult<()>
where
Expand Down
4 changes: 2 additions & 2 deletions src/images/buffer_par.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ where
/// Returns a parallel iterator over the pixels of this image and their coordinates, usable with `rayon`.
/// See [`enumerate_pixels`] for more information.
///
/// [`enumerate_pixels`]: #method.enumerate_pixels
/// [`enumerate_pixels`]: Self::enumerate_pixels
pub fn par_enumerate_pixels(&self) -> EnumeratePixelsPar<'_, P> {
EnumeratePixelsPar {
pixels: self.pixels().par_iter(),
Expand All @@ -209,7 +209,7 @@ where
/// Returns a parallel iterator over the mutable pixels of this image and their coordinates, usable with `rayon`.
/// See [`enumerate_pixels_mut`] for more information.
///
/// [`enumerate_pixels_mut`]: #method.enumerate_pixels_mut
/// [`enumerate_pixels_mut`]: Self::enumerate_pixels_mut
pub fn par_enumerate_pixels_mut(&mut self) -> EnumeratePixelsMutPar<'_, P> {
let width = self.width();
EnumeratePixelsMutPar {
Expand Down
4 changes: 2 additions & 2 deletions src/images/dynimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,11 +1718,11 @@ pub fn load_from_memory(buffer: &[u8]) -> ImageResult<DynamicImage> {
/// Create a new image from a byte slice
///
/// This is just a simple wrapper that constructs an `std::io::Cursor` around the buffer and then
/// calls `load` with that reader.
/// calls [`load`] with that reader.
///
/// Try [`ImageReaderOptions`] for more advanced uses.
///
/// [`load`]: fn.load.html
/// [`load`]: crate::load
#[inline(always)]
pub fn load_from_memory_with_format(buf: &[u8], format: ImageFormat) -> ImageResult<DynamicImage> {
// Note: this function (and `load_from_memory`) were supposed to be generic over `AsRef<[u8]>`
Expand Down
13 changes: 5 additions & 8 deletions src/images/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,11 @@ use crate::{GenericImage, GenericImageView, ImageBuffer};
/// single pixel as the backing storage for an arbitrarily sized read-only raster by mapping each
/// pixel to the same samples by setting some strides to `0`.
///
/// [`GenericImage`]: ../trait.GenericImage.html
/// [`GenericImageView`]: ../trait.GenericImageView.html
/// [`ImageBuffer::as_flat_samples`]: ../struct.ImageBuffer.html#method.as_flat_samples
/// [`is_normal`]: #method.is_normal
/// [`has_aliased_samples`]: #method.has_aliased_samples
/// [`as_view`]: #method.as_view
/// [`as_view_mut`]: #method.as_view_mut
/// [`with_monocolor`]: #method.with_monocolor
/// [`is_normal`]: Self::is_normal
/// [`has_aliased_samples`]: Self::has_aliased_samples
/// [`as_view`]: Self::as_view
/// [`as_view_mut`]: Self::as_view_mut
/// [`with_monocolor`]: Self::with_monocolor
#[derive(Clone, Debug)]
pub struct FlatSamples<Buffer> {
/// Underlying linear container holding sample values.
Expand Down
7 changes: 3 additions & 4 deletions src/images/generic_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub trait GenericImageView {
///
/// The coordinates must be [`in_bounds`] of the image.
///
/// [`in_bounds`]: #method.in_bounds
/// [`in_bounds`]: Self::in_bounds
unsafe fn unsafe_get_pixel(&self, x: u32, y: u32) -> Self::Pixel {
self.get_pixel(x, y)
}
Expand Down Expand Up @@ -197,7 +197,7 @@ pub trait GenericImage: GenericImageView {
///
/// The coordinates must be [`in_bounds`] of the image.
///
/// [`in_bounds`]: traits.GenericImageView.html#method.in_bounds
/// [`in_bounds`]: GenericImageView::in_bounds
unsafe fn unsafe_put_pixel(&mut self, x: u32, y: u32, pixel: Self::Pixel) {
self.put_pixel(x, y, pixel);
}
Expand All @@ -215,8 +215,7 @@ pub trait GenericImage: GenericImageView {
/// # Returns
/// Returns an error if the image is too large to be copied at the given position
///
/// [`GenericImageView::view`]: trait.GenericImageView.html#method.view
/// [`FlatSamples`]: flat/struct.FlatSamples.html
/// [`FlatSamples`]: crate::FlatSamples
fn copy_from<O>(&mut self, other: &O, x: u32, y: u32) -> ImageResult<()>
where
O: GenericImageView<Pixel = Self::Pixel>,
Expand Down
6 changes: 3 additions & 3 deletions src/io/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ pub trait ImageDecoder {
/// **Note**: By default, _no_ limits are defined. This may be changed in future major version
/// increases.
///
/// [`Limits`]: ./io/struct.Limits.html
/// [`Limits::check_support`]: ./io/struct.Limits.html#method.check_support
/// [`Limits::check_dimensions`]: ./io/struct.Limits.html#method.check_dimensions
/// [`Limits`]: crate::Limits
/// [`Limits::check_support`]: crate::Limits::check_support
/// [`Limits::check_dimensions`]: crate::Limits::check_dimensions
fn set_limits(&mut self, limits: crate::Limits) -> ImageResult<()> {
limits.check_support(&crate::LimitSupport::default())?;
let layout = self.prepare_image()?;
Expand Down
8 changes: 4 additions & 4 deletions src/io/image_reader_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ enum Format {
/// As a final fallback or if only a specific format must be used, the reader always allows manual
/// specification of the supposed image format with [`set_format`].
///
/// [`set_format`]: #method.set_format
/// [`set_format`]: Self::set_format
pub struct ImageReaderOptions<R: Read + Seek> {
/// The reader. Should be buffered.
inner: R,
Expand All @@ -102,8 +102,8 @@ impl<'a, R: 'a + BufRead + Seek> ImageReaderOptions<R> {
/// It is possible to guess the format based on the content of the read object with
/// [`with_guessed_format`], or to set the format directly with [`set_format`].
///
/// [`with_guessed_format`]: #method.with_guessed_format
/// [`set_format`]: method.set_format
/// [`with_guessed_format`]: Self::with_guessed_format
/// [`set_format`]:Self::set_format
pub fn new(buffered_reader: R) -> Self {
ImageReaderOptions {
inner: buffered_reader,
Expand Down Expand Up @@ -454,7 +454,7 @@ impl ImageReaderOptions<BufReader<File>> {
/// If you want to inspect the content for a better guess on the format, which does not depend
/// on file extensions, follow this call with a call to [`with_guessed_format`].
///
/// [`with_guessed_format`]: #method.with_guessed_format
/// [`with_guessed_format`]: Self::with_guessed_format
pub fn open<P>(path: P) -> io::Result<Self>
where
P: AsRef<Path>,
Expand Down
11 changes: 5 additions & 6 deletions src/io/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ pub struct LimitSupport {}
/// The limit check should only ever fail if a limit will be exceeded or an unsupported strict
/// limit is used.
///
/// [`LimitSupport`]: ./struct.LimitSupport.html
/// [`ImageDecoder::set_limits`]: ../trait.ImageDecoder.html#method.set_limits
/// [`ImageDecoder::set_limits`]: crate::ImageDecoder::set_limits
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[allow(missing_copy_implementations)]
#[non_exhaustive]
Expand Down Expand Up @@ -119,7 +118,7 @@ impl Limits {

/// This function acts identically to [`reserve`], but takes a `usize` for convenience.
///
/// [`reserve`]: #method.reserve
/// [`reserve`]: Self::reserve
pub fn reserve_usize(&mut self, amount: usize) -> ImageResult<()> {
match u64::try_from(amount) {
Ok(n) => self.reserve(n),
Expand All @@ -137,7 +136,7 @@ impl Limits {
/// used to create an [`ImageBuffer`] and does all the math for you.
///
/// [`ImageBuffer`]: crate::ImageBuffer
/// [`reserve`]: #method.reserve
/// [`reserve`]: Self::reserve
pub fn reserve_buffer(
&mut self,
width: u32,
Expand All @@ -155,7 +154,7 @@ impl Limits {
/// This function increases the `max_alloc` limit with amount. Should only be used
/// together with [`reserve`].
///
/// [`reserve`]: #method.reserve
/// [`reserve`]: Self::reserve
pub fn free(&mut self, amount: u64) {
if let Some(max_alloc) = self.max_alloc.as_mut() {
*max_alloc = max_alloc.saturating_add(amount);
Expand All @@ -164,7 +163,7 @@ impl Limits {

/// This function acts identically to [`free`], but takes a `usize` for convenience.
///
/// [`free`]: #method.free
/// [`free`]: Self::free
pub fn free_usize(&mut self, amount: usize) {
match u64::try_from(amount) {
Ok(n) => self.free(n),
Expand Down
13 changes: 2 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
//!
//! With default features, the crate includes support for [many common image formats](codecs/index.html#supported-formats).
//!
//! [`save`]: enum.DynamicImage.html#method.save
//! [`write_to`]: enum.DynamicImage.html#method.write_to
//! [`save`]: DynamicImage::save
//! [`write_to`]: DynamicImage::write_to
//!
//! # Image buffers
//!
Expand All @@ -63,11 +63,6 @@
//! * [`flat`] module containing types for interoperability with generic channel
//! matrices and foreign interfaces.
//!
//! [`GenericImageView`]: trait.GenericImageView.html
//! [`GenericImage`]: trait.GenericImage.html
//! [`ImageBuffer`]: struct.ImageBuffer.html
//! [`DynamicImage`]: enum.DynamicImage.html
//! [`flat`]: flat/index.html
//!
//! # Low level encoding/decoding API
//!
Expand Down Expand Up @@ -107,10 +102,6 @@
//! # }
//! # #[cfg(not(feature = "png"))] fn main() {}
//! ```
//!
//! [`DynamicImage::from_decoder`]: enum.DynamicImage.html#method.from_decoder
//! [`ImageDecoder`]: trait.ImageDecoder.html
//! [`ImageEncoder`]: trait.ImageEncoder.html
#![warn(missing_docs)]
#![warn(unused_qualifications)]
#![deny(unreachable_pub)]
Expand Down
Loading