Skip to main content

Processor

Struct Processor 

Source
pub struct Processor { /* private fields */ }

Implementations§

Source§

impl Processor

Source

pub fn new(config: ProcessConfig) -> Self

Source

pub fn expected_output_path(&self, input_path: &Path) -> PathBuf

纯路径计算:给定输入文件,返回将要生成的输出路径(不创建目录、不做任何 IO 写入)。 供上层「续跑跳过」幂等判断复用,与 process_image 内部逻辑严格同源。

v4.3.1 增强:

  • preserve_structure=true 时,按 structure_base 复刻源目录相对层级到 output_dir(修 D2 拍平)。
  • output_suffix 可覆盖默认 _wx/_hd/_da;空串=无后缀。keep_original_name 优先级最高(无后缀)。
  • 支持 WebP 输出扩展名。
Source

pub fn passthrough_path(&self, input_path: &Path) -> PathBuf

透传路径:不支持的格式(如 SVG)原样复制到 output_dir(保持保结构层级、不改名不改扩展名)。 与 expected_output_path 仅在「不加后缀」上有区别,便于 passthrough 模式 1:1 映射源文件名。

Source

pub fn process_image(&self, input_path: &Path) -> Result<PathBuf>

Source

pub fn process_image_with_metrics( &self, input_path: &Path, ) -> Result<(PathBuf, Option<PerceptualMetrics>)>

v4.2.0-exp:处理并返回感知指标(perceptual=None 时指标恒为 None,行为同 v4.1.0)

Source

pub fn perceptual_config(&self) -> Option<&PerceptualOptions>

返回当前感知压缩配置(None = 走 v4.1.0 旧路径),供 CLI/JSON 输出 metrics 元数据

Source

pub fn effective_target_kb(&self) -> u32

实际生效的体积预算(KB):感知模式 budget_kb 覆盖 target_kb

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.