pub struct Document {
pub header: Header,
pub pages: Vec<PageInfo>,
pub cells: Vec<CellRecord>,
pub dict: IndexMap<CodeHash, String>,
pub numguards: Vec<NumGuard>,
}Fields§
§header: Header§pages: Vec<PageInfo>§cells: Vec<CellRecord>§dict: IndexMap<CodeHash, String>§numguards: Vec<NumGuard>Implementations§
Source§impl Document
impl Document
pub fn new(header: Header) -> Self
pub fn add_page(&mut self, info: PageInfo)
pub fn push_cell(&mut self, cell: CellRecord, payload: String)
pub fn add_numguard(&mut self, guard: NumGuard)
pub fn payload_for(&self, code_id: &CodeHash) -> Option<&str>
pub fn ordered_cells(&self) -> Vec<CellRecord>
pub fn to_proto(&self) -> Document
pub fn from_proto(doc: Document) -> Result<Self>
pub fn to_bytes(&self) -> Result<Vec<u8>>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn save_bin<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn load_bin<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn save_json<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn load_json<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn total_cells(&self) -> usize
pub fn total_pages(&self) -> usize
pub fn ensure_dict_entry(&mut self, payload: &str) -> CodeHash
pub fn page_dims(&self, z: u32) -> Option<(u32, u32)>
pub fn iter_cells(&self) -> impl Iterator<Item = &CellRecord>
pub fn decode_to_text(&self) -> String
pub fn decode_page_to_text(&self, z: u32) -> String
pub fn decode_cells_to_text(&self, cells: &[CellRecord]) -> String
pub fn cells_in_bbox( &self, z: u32, x0: i32, y0: i32, x1: i32, y1: i32, ) -> Vec<CellRecord>
Source§impl Document
impl Document
pub fn retain_dict_for_cells(&mut self)
pub fn numguard_mismatches(&self) -> Vec<NumGuardAlert>
pub fn numguard_mismatches_with_units( &self, whitelist: Option<&HashSet<String>>, ) -> Vec<NumGuardAlert>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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