three_dcf_core/
decoder.rs1use crate::document::Document;
2use crate::error::Result;
3
4#[derive(Debug, Default)]
5pub struct Decoder;
6
7impl Decoder {
8 pub fn new() -> Self {
9 Self
10 }
11
12 pub fn to_text(&self, document: &Document) -> Result<String> {
13 Ok(document.decode_to_text())
14 }
15
16 pub fn page_to_text(&self, document: &Document, z: u32) -> Result<String> {
17 Ok(document.decode_page_to_text(z))
18 }
19
20 pub fn bbox_to_text(
21 &self,
22 document: &Document,
23 z: u32,
24 x0: i32,
25 y0: i32,
26 x1: i32,
27 y1: i32,
28 ) -> Result<String> {
29 let cells = document.cells_in_bbox(z, x0, y0, x1, y1);
30 Ok(document.decode_cells_to_text(&cells))
31 }
32}