Skip to main content

gaze_document/layout/
mod.rs

1//! Layout / reading-order helpers.
2//!
3//! OCR backends emit flat spans. This module keeps the reading-order policy in
4//! `gaze-document` so downstream recognizers receive coherent text blocks
5//! instead of row-wise interleaving from multi-column pages.
6
7use crate::DocumentError;
8
9/// Reading-order handle for a single document.
10///
11/// Pre-0.1 placeholder for the eventual public multi-page layout contract.
12#[non_exhaustive]
13pub struct ReadingOrder {
14    _private: (),
15}
16
17impl ReadingOrder {
18    /// Build a reading-order handle.
19    ///
20    /// # Errors
21    /// Always returns [`DocumentError::NotImplemented`] until the public
22    /// reading-order contract lands.
23    pub fn new() -> Result<Self, DocumentError> {
24        Err(DocumentError::NotImplemented(
25            "ReadingOrder::new (public reading-order contract deferred)",
26        ))
27    }
28
29    /// Infer reading order from raw page payloads.
30    ///
31    /// # Errors
32    /// Returns [`DocumentError::NotImplemented`] until the public
33    /// reading-order contract lands.
34    pub fn infer(_pages: &[&[u8]]) -> Result<Self, DocumentError> {
35        Err(DocumentError::NotImplemented(
36            "ReadingOrder::infer (public reading-order contract deferred)",
37        ))
38    }
39}