Skip to content

Commit

Permalink
API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Nov 29, 2024
1 parent e8e8309 commit 7324c80
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ mod zopfli_oxipng;
#[cfg(feature = "zopfli")]
pub use zopfli_oxipng::deflate as zopfli_deflate;

/// DEFLATE algorithms supported by oxipng (for use in [`Options`][crate::Options])
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
/// DEFLATE algorithms supported by oxipng
pub enum Deflaters {
/// Use libdeflater.
Libdeflater {
Expand Down
1 change: 1 addition & 0 deletions src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{fmt, fmt::Display, mem::transmute};

use crate::error::PngError;

/// Filtering strategy for use in [`Options`][crate::Options]
#[repr(u8)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)]
pub enum RowFilter {
Expand Down
2 changes: 1 addition & 1 deletion src/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ pub struct Chunk {
pub data: Vec<u8>,
}

/// [`Options`][crate::Options] to use when stripping chunks (metadata)
#[derive(Debug, PartialEq, Eq, Clone)]
/// Options to use when stripping chunks
pub enum StripChunks {
/// None
None,
Expand Down
3 changes: 3 additions & 0 deletions src/interlace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ use bitvec::prelude::*;

use crate::{headers::IhdrData, png::PngImage, PngError};

/// Whether to enable progressive rendering. See [`Options`][crate::Options])
#[repr(u8)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Interlacing {
/// Makes images load top to bottom.
None,
/// Makes it possible to render partially-loaded images at lower resolution. Usually increases file sizes.
Adam7,
}

Expand Down
8 changes: 6 additions & 2 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use log::warn;

use crate::{deflate::Deflaters, filters::RowFilter, headers::StripChunks, interlace::Interlacing};

/// Write destination for [`optimize`][crate::optimize].
/// You can use [`optimize_from_memory`](crate::optimize_from_memory) to avoid external I/O.
#[derive(Clone, Debug)]
pub enum OutFile {
/// Don't actually write any output, just calculate the best results.
Expand Down Expand Up @@ -46,7 +48,8 @@ impl OutFile {
}
}

/// Where to read images from
/// Where to read images from in [`optimize`][crate::optimize].
/// You can use [`optimize_from_memory`](crate::optimize_from_memory) to avoid external I/O.
#[derive(Clone, Debug)]
pub enum InFile {
Path(PathBuf),
Expand Down Expand Up @@ -133,7 +136,8 @@ pub struct Options {
///
/// Default: `None`
pub strip: StripChunks,
/// Which DEFLATE algorithm to use
/// Which DEFLATE (zlib) algorithm to use
#[cfg_attr(feature = "zopfli", doc = "(e.g. Zopfli)")]
///
/// Default: `Libdeflater`
pub deflate: Deflaters,
Expand Down

0 comments on commit 7324c80

Please sign in to comment.