#[non_exhaustive]pub struct ScanConfig {Show 13 fields
pub budget_ms: Option<u64>,
pub pyramid: bool,
pub direct: bool,
pub enhance: bool,
pub deep: bool,
pub pyramid_side: u32,
pub max_engine_side: u32,
pub score_depth: ScoreDepth,
pub score_skip_axes: Vec<StressAxis>,
pub score_skip_checks: Vec<ScoreCheck>,
pub alpha_background: AlphaBackground,
pub alpha_palette: Vec<[u8; 3]>,
pub formats: Vec<Symbology>,
}Expand description
Stage-level scan configuration. Build from a profile preset, then adjust public fields as needed (the struct is non-exhaustive: presets are the only constructors). Clone-not-Copy: the axis-skip list is a collection.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.budget_ms: Option<u64>Wall-clock budget in milliseconds. None = unbounded: the scan runs the full
ladder, bounded only by the input-size Limits, never by time — the mode for
strictly reproducible reports. Every built-in profile sets one (full 4 s · fast
800 ms · frame 80 ms) and server callers should keep a budget. A planned unit
the deadline prevents does not run and the report says so
(trace.budget_exhausted): a judgment it interrupts is absent, never partial.
(Some(0) cuts immediately; bindings exposing a numeric budget map 0 →
unbounded — see each binding’s docs.)
pyramid: boolS1 — decode a ≤pyramid_side downscale first (cheapest win).
direct: boolS2 — decode the full-resolution luma.
enhance: boolS3 — enhance set: otsu · invert · contrast · R/G/B channels.
deep: boolS4 — curated deep grid (size × contrast × binarization).
pyramid_side: u32Longest side of the S1 pyramid attempt.
max_engine_side: u32Hard cap on the longest side of ANY image handed to the engines —
the wall-clock of one engine call is otherwise unbounded (a single
rxing TryHarder pass on 64MP runs for minutes and is not
interruptible). Detections are rescaled to original coordinates.
score_depth: ScoreDepthStress-scoring depth applied after a successful decode.
score_skip_axes: Vec<StressAxis>Stress axes EXCLUDED from scoring — integration config for hosts
where an axis is meaningless (a generated preview has no capture
angle: builders skip perspective + rotation). Skipped axes never
run (their stress cells are never built — real wall-clock savings)
and the composite renormalizes over the axes that DID run, so the
value stays 0-100 on the same contract-v3 weights. The report
self-describes: score.axes carries only the axes that ran. Empty
(every profile’s default) = the full six-axis contract, byte for
byte. Skipping ALL axes yields no score at all (an axis-less value
would be fiction) — same outcome as ScoreDepth::Off.
score_skip_checks: Vec<ScoreCheck>Score SECTIONS excluded from the report — the same integration seam
as score_skip_axes, for report blocks instead of stress axes. A
host that displays neither the correction margin nor the ISO
parameters skips uec + iso15415: the wire carries null for
them and the UEC-driven hints never fire. The UEC margin is still
measured and caps the composite, so score.value, score.grade and
the ISO overall never move — skipping checks is surface truth,
never score surgery. Empty (every profile’s default) = every section
runs, byte for byte.
alpha_background: AlphaBackgroundBackground handling for inputs that carry transparent pixels — the flatten runs BEFORE luma conversion and RGB extraction, so every downstream stage (ladder · score · UEC · ISO) sees the composited image. Opaque inputs never enter this path: their reports stay byte-identical whatever this is set to.
alpha_palette: Vec<[u8; 3]>HOST palette colors probed by the placement envelope, on top of the
neutral sweep — “does my design survive on MY theme/brand colors”,
answered inside one scan instead of one full scan per color
(alpha.envelope.palette). Probes are luma-space like the rest of
the sweep and budget-bounded per probe. At most
ScanConfig::MAX_ALPHA_PALETTE colors (a palette is the first
caller-sized loop in the scan path — unbounded, it would be a CPU
amplifier under budget_ms: None): ScanConfig::validate, which
every scan runs first, refuses a longer one with QRS-006, and the
bindings refuse a longer list before the core sees it, with their own
argument error. Empty (every profile’s default) = the neutral sweep
only.
formats: Vec<Symbology>The symbologies the scan looks for. Empty (every profile’s default)
= every symbology the build reads. A host that only handles some of
them names those: no reader of another symbology runs in any stage,
and the stages that exist for the others are not planned — the
native-resolution completion after a QR pyramid read when no listed
symbology is outside the QR family, the deep stage when none is
inside it. A listed symbology is read by the same readers, judged
and reported as in an unrestricted scan, with the one difference
that fewer readers imply: an unrestricted scan sets each symbol it
reads aside and reads again around it, so a symbol that shares its
rows with one of an unlisted symbology (two linear codes side by
side) can need its neighbor listed to be read; and a UPC-A symbol
read with ean13 listed and upc_a not is the EAN-13 it also is
(a leading zero). The report says what it looked for
(trace.formats).
Implementations§
Source§impl ScanConfig
impl ScanConfig
Sourcepub const MAX_ALPHA_PALETTE: usize = 32
pub const MAX_ALPHA_PALETTE: usize = 32
Hard cap on alpha_palette (anti-DoS: a palette entry costs a
composite + up to three decode attempts). ScanConfig::validate
refuses a longer palette with QRS-006; every binding refuses one
before the core sees it. 32 covers any real theme/brand palette with
headroom.
Sourcepub const MAX_BUDGET_MS: u64 = 4_294_967_295
pub const MAX_BUDGET_MS: u64 = 4_294_967_295
The largest budget_ms a scan accepts: 4 294 967 295 ms (about 49.7
days), the one range every binding can carry exactly and every
platform clock can add to now. A larger budget is refused
(QRS-006), never silently made unbounded.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Refuse a configuration no scan can honour (QRS-006), before any
input is read: a budget above ScanConfig::MAX_BUDGET_MS, a zero
pyramid or engine side, a palette above
ScanConfig::MAX_ALPHA_PALETTE. crate::Scanner::scan checks it
first.
§Errors
QRS-006 naming the first option out of its domain.
Sourcepub fn formats_from_names<S: AsRef<str>>(names: &[S]) -> Result<Vec<Symbology>>
pub fn formats_from_names<S: AsRef<str>>(names: &[S]) -> Result<Vec<Symbology>>
The symbologies named by names, for ScanConfig::formats: wire
names (crate::Symbology::name: qr_code, ean13, …), in the
order given. One parser for every binding, so they accept and refuse
the same names.
§Errors
QRS-006 naming the first unknown name: a typo never widens the
scan back to every symbology.
Sourcepub fn computes_score(&self) -> bool
pub fn computes_score(&self) -> bool
Whether this configuration judges a detection at all: false for
score depth ScoreDepth::Off (the frame profile) and when every
stress axis is skipped — such scans publish score: null whatever
they decode and whatever the budget.
Trait Implementations§
Source§impl Clone for ScanConfig
impl Clone for ScanConfig
Source§impl Debug for ScanConfig
impl Debug for ScanConfig
impl Eq for ScanConfig
Source§impl PartialEq for ScanConfig
impl PartialEq for ScanConfig
impl StructuralPartialEq for ScanConfig
Auto Trait Implementations§
impl Forget for ScanConfig
impl Freeze for ScanConfigwhere
*const u8 is !null: Freeze,
PhantomData<StressAxis>: Freeze,
PhantomData<ScoreCheck>: Freeze,
PhantomData<[u8; 3]>: Freeze,
PhantomData<Symbology>: Freeze,
impl Move for ScanConfig
impl RefUnwindSafe for ScanConfig
impl Send for ScanConfigwhere
RawVecInner: Send,
impl Sync for ScanConfigwhere
RawVecInner: Sync,
impl Unpin for ScanConfig
impl UnsafeUnpin for ScanConfigwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<StressAxis>: UnsafeUnpin,
PhantomData<ScoreCheck>: UnsafeUnpin,
PhantomData<[u8; 3]>: UnsafeUnpin,
PhantomData<Symbology>: UnsafeUnpin,
impl UnwindSafe for ScanConfigwhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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