pub enum OcrMode {
Default,
FullPage,
LayoutRegions,
PdfAwareLayoutRegions,
}Expand description
Which document regions feed the OCR — docling 2.116’s OcrMode (#254,
upstream docling#3710). Upstream restructured its pipeline so OCR runs
after layout, on layout regions filtered by the PDF text layer — the
architecture this port has always had — and named the strategies:
PdfAwareLayoutRegions(upstream’s default): OCR only layout regions the embedded text layer can’t cover. Exactly the standard path here — scanned pages OCR their regions, digital pages OCR only text-less bitmap areas.FullPage/LayoutRegions: ignore the PDF text layer and OCR everything. Both map onto theforce_full_page_ocrmachinery (discard the text layer, OCR every layout region): the upstream distinction — whole-page vs per-region detector input — has no analogue in this engine, whose PP-OCR recognizer always consumes per-region line crops.
Variants§
Default
Upstream’s default: currently wired to PdfAwareLayoutRegions.
FullPage
OCR the full page, text layer ignored (docling’s full_page; the
mode-shaped spelling of force_full_page_ocr).
LayoutRegions
OCR every layout region, text layer ignored (docling’s
layout_regions).
PdfAwareLayoutRegions
OCR layout regions the text layer can’t cover (docling’s
pdf_aware_layout_regions — the default behavior).
Implementations§
Source§impl OcrMode
impl OcrMode
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse docling’s mode ids. None for anything else — callers surface
their own error/warning.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
The process-level choice from DOCLING_RS_OCR_MODE (empty/unset → the
default; unknown values warn and use the default).
Sourcepub fn forces_full_page(self) -> bool
pub fn forces_full_page(self) -> bool
Whether this mode discards the embedded text layer — the engine truth both non-default modes reduce to.
Trait Implementations§
impl Copy for OcrMode
impl Eq for OcrMode
impl StructuralPartialEq for OcrMode
Auto Trait Implementations§
impl Freeze for OcrMode
impl RefUnwindSafe for OcrMode
impl Send for OcrMode
impl Sync for OcrMode
impl Unpin for OcrMode
impl UnsafeUnpin for OcrMode
impl UnwindSafe for OcrMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().