summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-12-02 13:37:33 +0100
committerLaurenz <laurmaedje@gmail.com>2024-12-04 10:12:07 +0100
commitf8f2ba6a5f8c8ca7dbb85cf17b73332a0c301c60 (patch)
treeb3bc754509fb3ab4c74493848fe96f116b7907ed /crates/typst-library/src/layout
parent76c24ee6e35715cd14bb892d7b6b8d775c680bf7 (diff)
Rename `Document` to `PagedDocument`
Diffstat (limited to 'crates/typst-library/src/layout')
-rw-r--r--crates/typst-library/src/layout/page.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/crates/typst-library/src/layout/page.rs b/crates/typst-library/src/layout/page.rs
index 09aafa7f..68fd8974 100644
--- a/crates/typst-library/src/layout/page.rs
+++ b/crates/typst-library/src/layout/page.rs
@@ -12,11 +12,12 @@ use crate::foundations::{
cast, elem, Args, AutoValue, Cast, Construct, Content, Context, Dict, Fold, Func,
NativeElement, Set, Smart, StyleChain, Value,
};
+use crate::introspection::Introspector;
use crate::layout::{
Abs, Alignment, FlushElem, Frame, HAlignment, Length, OuterVAlignment, Ratio, Rel,
Sides, SpecificAlignment,
};
-use crate::model::Numbering;
+use crate::model::{DocumentInfo, Numbering};
use crate::text::LocalName;
use crate::visualize::{Color, Paint};
@@ -451,6 +452,17 @@ impl PagebreakElem {
}
}
+/// A finished document with metadata and page frames.
+#[derive(Debug, Default, Clone)]
+pub struct PagedDocument {
+ /// The document's finished pages.
+ pub pages: Vec<Page>,
+ /// Details about the document.
+ pub info: DocumentInfo,
+ /// Provides the ability to execute queries on the document.
+ pub introspector: Introspector,
+}
+
/// A finished page.
#[derive(Debug, Clone)]
pub struct Page {
@@ -942,3 +954,14 @@ papers! {
(PRESENTATION_16_9: 297.0, 167.0625, "presentation-16-9")
(PRESENTATION_4_3: 280.0, 210.0, "presentation-4-3")
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_paged_document_is_send_and_sync() {
+ fn ensure_send_and_sync<T: Send + Sync>() {}
+ ensure_send_and_sync::<PagedDocument>();
+ }
+}