Skip to content

Commit

Permalink
fix typos and links for io::Limits docs (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScanMountGoat committed May 4, 2024
1 parent 5013041 commit d710467
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ pub struct LimitSupport {}
///
/// Limits can be either *strict* or *non-strict*. Non-strict limits are best-effort
/// limits where the library does not guarantee that limit will not be exceeded. Do note
/// that it is still considered a bug if a non-strict limit is exceeded, however as
/// some of the underlying decoders do not support not support such limits one cannot
/// rely on these limits being supported. For stric limits the library makes a stronger
/// that it is still considered a bug if a non-strict limit is exceeded.
/// Some of the underlying decoders do not support such limits, so one cannot
/// rely on these limits being supported. For strict limits, the library makes a stronger
/// guarantee that the limit will not be exceeded. Exceeding a strict limit is considered
/// a critical bug. If a decoder cannot guarantee that it will uphold a strict limit it
/// *must* fail with `image::error::LimitErrorKind::Unsupported`.
/// a critical bug. If a decoder cannot guarantee that it will uphold a strict limit, it
/// *must* fail with [error::LimitErrorKind::Unsupported].
///
/// Currently the only strict limits supported are the `max_image_width` and `max_image_height`
/// limits, however more will be added in the future. [`LimitSupport`] will default to support
/// being false and decoders should enable support for the limits they support in
/// The only currently supported strict limits are the `max_image_width` and `max_image_height`
/// limits, but more will be added in the future. [`LimitSupport`] will default to support
/// being false, and decoders should enable support for the limits they support in
/// [`ImageDecoder::set_limits`].
///
/// The limit check should only ever fail if a limit will be exceeded or an unsupported strict
Expand Down Expand Up @@ -113,6 +113,8 @@ impl Limits {
}

/// This function acts identically to [`reserve`], but takes a `usize` for convenience.
///
/// [`reserve`]: #method.reserve
pub fn reserve_usize(&mut self, amount: usize) -> ImageResult<()> {
match u64::try_from(amount) {
Ok(n) => self.reserve(n),
Expand All @@ -128,6 +130,9 @@ impl Limits {

/// This function acts identically to [`reserve`], but accepts the width, height and color type
/// used to create an [`ImageBuffer`] and does all the math for you.
///
/// [`ImageBuffer`]: crate::ImageBuffer
/// [`reserve`]: #method.reserve
pub fn reserve_buffer(
&mut self,
width: u32,
Expand All @@ -153,6 +158,8 @@ impl Limits {
}

/// This function acts identically to [`free`], but takes a `usize` for convenience.
///
/// [`free`]: #method.free
pub fn free_usize(&mut self, amount: usize) {
match u64::try_from(amount) {
Ok(n) => self.free(n),
Expand Down

0 comments on commit d710467

Please sign in to comment.