pub struct Processor { /* private fields */ }Implementations§
Source§impl Processor
impl Processor
pub fn new(config: ProcessConfig) -> Self
Sourcepub fn expected_output_path(&self, input_path: &Path) -> PathBuf
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 输出扩展名。
Sourcepub fn passthrough_path(&self, input_path: &Path) -> PathBuf
pub fn passthrough_path(&self, input_path: &Path) -> PathBuf
透传路径:不支持的格式(如 SVG)原样复制到 output_dir(保持保结构层级、不改名不改扩展名)。 与 expected_output_path 仅在「不加后缀」上有区别,便于 passthrough 模式 1:1 映射源文件名。
pub fn process_image(&self, input_path: &Path) -> Result<PathBuf>
Sourcepub fn process_image_with_metrics(
&self,
input_path: &Path,
) -> Result<(PathBuf, Option<PerceptualMetrics>)>
pub fn process_image_with_metrics( &self, input_path: &Path, ) -> Result<(PathBuf, Option<PerceptualMetrics>)>
v4.2.0-exp:处理并返回感知指标(perceptual=None 时指标恒为 None,行为同 v4.1.0)
Sourcepub fn perceptual_config(&self) -> Option<&PerceptualOptions>
pub fn perceptual_config(&self) -> Option<&PerceptualOptions>
返回当前感知压缩配置(None = 走 v4.1.0 旧路径),供 CLI/JSON 输出 metrics 元数据
Sourcepub fn effective_target_kb(&self) -> u32
pub fn effective_target_kb(&self) -> u32
实际生效的体积预算(KB):感知模式 budget_kb 覆盖 target_kb
Auto Trait Implementations§
impl Freeze for Processor
impl RefUnwindSafe for Processor
impl Send for Processor
impl Sync for Processor
impl Unpin for Processor
impl UnsafeUnpin for Processor
impl UnwindSafe for Processor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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