summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorTobias Schmitz <tobiasschmitz2001@gmail.com>2025-05-23 09:31:26 +0200
committerGitHub <noreply@github.com>2025-05-23 07:31:26 +0000
commit2a258a0c3849073c56a0559dbd67ee2effcd1031 (patch)
treed5a500f525b910dae873d5571faf064c57374304 /crates/typst-library/src
parentdf89a0e85b80844ef56a6fa98af01eaaf7553da8 (diff)
Remove unused Marginal type (#6321)
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/layout/page.rs43
1 files changed, 2 insertions, 41 deletions
diff --git a/crates/typst-library/src/layout/page.rs b/crates/typst-library/src/layout/page.rs
index 62e25278..98afbd06 100644
--- a/crates/typst-library/src/layout/page.rs
+++ b/crates/typst-library/src/layout/page.rs
@@ -1,16 +1,14 @@
-use std::borrow::Cow;
use std::num::NonZeroUsize;
use std::ops::RangeInclusive;
use std::str::FromStr;
-use comemo::Track;
use typst_utils::{singleton, NonZeroExt, Scalar};
use crate::diag::{bail, SourceResult};
use crate::engine::Engine;
use crate::foundations::{
- cast, elem, Args, AutoValue, Cast, Construct, Content, Context, Dict, Fold, Func,
- NativeElement, Set, Smart, StyleChain, Value,
+ cast, elem, Args, AutoValue, Cast, Construct, Content, Dict, Fold, NativeElement,
+ Set, Smart, Value,
};
use crate::introspection::Introspector;
use crate::layout::{
@@ -649,43 +647,6 @@ cast! {
},
}
-/// A header, footer, foreground or background definition.
-#[derive(Debug, Clone, Hash)]
-pub enum Marginal {
- /// Bare content.
- Content(Content),
- /// A closure mapping from a page number to content.
- Func(Func),
-}
-
-impl Marginal {
- /// Resolve the marginal based on the page number.
- pub fn resolve(
- &self,
- engine: &mut Engine,
- styles: StyleChain,
- page: usize,
- ) -> SourceResult<Cow<'_, Content>> {
- Ok(match self {
- Self::Content(content) => Cow::Borrowed(content),
- Self::Func(func) => Cow::Owned(
- func.call(engine, Context::new(None, Some(styles)).track(), [page])?
- .display(),
- ),
- })
- }
-}
-
-cast! {
- Marginal,
- self => match self {
- Self::Content(v) => v.into_value(),
- Self::Func(v) => v.into_value(),
- },
- v: Content => Self::Content(v),
- v: Func => Self::Func(v),
-}
-
/// A list of page ranges to be exported.
#[derive(Debug, Clone)]
pub struct PageRanges(Vec<PageRange>);