Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

refactor(engine): gather lib.rs's imports and re-exports under the module list

aleheldc224884cb9c
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index ebd0b5c7a..78e5ea1eb 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -59,6 +59,11 @@ pub mod word_count;
pub mod xfa;
mod xfa_form;
+use std::sync::Arc;
+
+pub use links::{
+ MAX_REMOTE_DOCUMENT_BYTES, RemoteDocumentPathError, read_remote_document, remote_document_path_is_absolute, resolve_remote_document_path,
+};
pub use signature_image::{ImageSignaturePreview, SignatureImage};
pub use signature_scan::{PhotoRect, ScanError, SignaturePhoto, Turn};
pub use stamp_preview::StampPreview;
@@ -66,6 +71,33 @@ pub use text_preview::TextEditPreview;
pub use reexports::*;
+use bookmarks::outline_rows;
+pub use bookmarks::{BookmarkPage, BookmarkRow};
+use comments::comment_list;
+pub use comments::{SummarySort, comment_kind, comment_summary, comment_type_name};
+pub use document::{Document, TextNotice, display_bytes_for, render_password_for};
+use document::{display_bytes, info_fields, recovered_render_password, same_pages, shown_under_redactions, undrawn_notices};
+pub use edit::{BATCH_LABELS, EDIT_LABELS, Edit};
+pub use error::{EditError, SourceProblem};
+pub use fill_sign::{displayed_offset, text_box_at, typed_signature_graphic, typed_signature_shape};
+pub use history::Label;
+use layers::{apply_layer_state, set_default_layer_state, use_layer_choices};
+pub use open::{OpenContext, PreparedDocument};
+pub use page_filter::{PageOrientation, PageParity, filter_pages};
+pub use pictures::MarkFile;
+use pictures::{embed_image, fit_picture, mark_source};
+use protection::unrestricted;
+pub use protection::{Changes, Printing, Protection, SecuritySummary};
+pub use session::Session;
+pub use sources::{CombineSource, Combined, combine_source_check, source_page_count};
+use sources::{open_source, open_source_with};
+#[cfg(test)]
+use test_hooks::{check_refresh_panic, panic_on_refresh, record_link_scan, record_marker_scan, reset_secondary_scan_counts, secondary_scan_counts};
+use xfa_form::{
+ XFA_REMOVED_PREFIX, XFA_SCRIPTS_OFF, decode_data_file, image_content_type, is_xfa_data_file, note_warnings, strip_xfa, sync_xfa_state,
+ undrawn_field_warnings, xfa_after_data_change, xfa_layout, xfa_redraw, xfa_sync_datasets, xfa_values_from_datasets,
+};
+
/// A change to an existing page image.
#[derive(Clone, Debug, PartialEq)]
pub enum ImageEdit {
@@ -88,10 +120,6 @@ pub enum ImageEdit {
Delete,
}
-pub use links::{
- MAX_REMOTE_DOCUMENT_BYTES, RemoteDocumentPathError, read_remote_document, remote_document_path_is_absolute, resolve_remote_document_path,
-};
-
/// Forms ▸ Merge data files into spreadsheet: the field values of each file (FDF, XFDF or a
/// filled-in PDF form), as CSV with one row per file.
pub fn merge_data_files(files: &[(String, Vec<u8>)]) -> Result<String, String> {
@@ -103,35 +131,6 @@ pub fn merge_data_files(files: &[(String, Vec<u8>)]) -> Result<String, String> {
/// One file produced by a split: (1-based first page, last page, PDF bytes).
pub type SplitPart = (usize, usize, Arc<Vec<u8>>);
-use std::sync::Arc;
-
-use bookmarks::outline_rows;
-pub use bookmarks::{BookmarkPage, BookmarkRow};
-use comments::comment_list;
-pub use comments::{SummarySort, comment_kind, comment_summary, comment_type_name};
-pub use document::{Document, TextNotice, display_bytes_for, render_password_for};
-use document::{display_bytes, info_fields, recovered_render_password, same_pages, shown_under_redactions, undrawn_notices};
-pub use edit::{BATCH_LABELS, EDIT_LABELS, Edit};
-pub use error::{EditError, SourceProblem};
-pub use fill_sign::{displayed_offset, text_box_at, typed_signature_graphic, typed_signature_shape};
-pub use history::Label;
-use layers::{apply_layer_state, set_default_layer_state, use_layer_choices};
-pub use open::{OpenContext, PreparedDocument};
-pub use page_filter::{PageOrientation, PageParity, filter_pages};
-pub use pictures::MarkFile;
-use pictures::{embed_image, fit_picture, mark_source};
-use protection::unrestricted;
-pub use protection::{Changes, Printing, Protection, SecuritySummary};
-pub use session::Session;
-pub use sources::{CombineSource, Combined, combine_source_check, source_page_count};
-use sources::{open_source, open_source_with};
-#[cfg(test)]
-use test_hooks::{check_refresh_panic, panic_on_refresh, record_link_scan, record_marker_scan, reset_secondary_scan_counts, secondary_scan_counts};
-use xfa_form::{
- XFA_REMOVED_PREFIX, XFA_SCRIPTS_OFF, decode_data_file, image_content_type, is_xfa_data_file, note_warnings, strip_xfa, sync_xfa_state,
- undrawn_field_warnings, xfa_after_data_change, xfa_layout, xfa_redraw, xfa_sync_datasets, xfa_values_from_datasets,
-};
-
/// Stable identifier of an open document within a session.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct DocId(pub u64);