packkit/level

Types

Compression level abstraction shared by codecs that expose a roughly “store .. best” numeric axis.

pub opaque type Level

Why a checked level constructor rejected the requested value.

pub type LevelError {
  LevelOutOfRange(value: Int)
}

Constructors

  • LevelOutOfRange(value: Int)

Values

pub fn balanced() -> Level

Human-friendly balanced alias.

pub fn best() -> Level

Highest generic compression setting.

pub fn custom(value value: Int) -> Level

Panicking counterpart of custom_checked.

pub fn custom_checked(
  value value: Int,
) -> Result(Level, LevelError)

Build a custom level or return a typed error when it falls outside the current generic range of 0..9.

pub fn default() -> Level

Project-default balanced setting.

pub fn fast() -> Level

Fastest practical compression setting.

pub fn label(level: Level) -> String

Stable string label for docs, tests, and diagnostics.

pub fn store() -> Level

Zero-compression / store mode.

pub fn value(level: Level) -> Int

Numeric value for a level.

Search Document