summaryrefslogtreecommitdiff
path: root/library/src/math
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-04-23 14:33:56 +0200
committerGitHub <noreply@github.com>2023-04-23 14:33:56 +0200
commit561ff979d574f496415c0499345d41da2e1f6e1e (patch)
tree037479ac000bd87a1cb2149e5389b28f08d24051 /library/src/math
parent2fbb14f712708188649181525813b3ac5a02e0fb (diff)
Add instrumentation (Part 1) (#761)
Diffstat (limited to 'library/src/math')
-rw-r--r--library/src/math/accent.rs1
-rw-r--r--library/src/math/align.rs1
-rw-r--r--library/src/math/attach.rs3
-rw-r--r--library/src/math/delimited.rs1
-rw-r--r--library/src/math/frac.rs1
-rw-r--r--library/src/math/matrix.rs3
-rw-r--r--library/src/math/mod.rs4
-rw-r--r--library/src/math/op.rs1
-rw-r--r--library/src/math/root.rs1
-rw-r--r--library/src/math/style.rs1
-rw-r--r--library/src/math/underover.rs6
11 files changed, 23 insertions, 0 deletions
diff --git a/library/src/math/accent.rs b/library/src/math/accent.rs
index 03263c3c..1cd84429 100644
--- a/library/src/math/accent.rs
+++ b/library/src/math/accent.rs
@@ -52,6 +52,7 @@ pub struct AccentElem {
}
impl LayoutMath for AccentElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
ctx.style(ctx.style.with_cramped(true));
let base = ctx.layout_fragment(&self.base())?;
diff --git a/library/src/math/align.rs b/library/src/math/align.rs
index 03abeac2..bbdda5fd 100644
--- a/library/src/math/align.rs
+++ b/library/src/math/align.rs
@@ -8,6 +8,7 @@ use super::*;
pub struct AlignPointElem {}
impl LayoutMath for AlignPointElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
ctx.push(MathFragment::Align);
Ok(())
diff --git a/library/src/math/attach.rs b/library/src/math/attach.rs
index c90b4945..dcf7fb78 100644
--- a/library/src/math/attach.rs
+++ b/library/src/math/attach.rs
@@ -27,6 +27,7 @@ pub struct AttachElem {
}
impl LayoutMath for AttachElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let base = self.base();
let display_limits = base.is::<LimitsElem>();
@@ -83,6 +84,7 @@ pub struct ScriptsElem {
}
impl LayoutMath for ScriptsElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
self.body().layout_math(ctx)
}
@@ -105,6 +107,7 @@ pub struct LimitsElem {
}
impl LayoutMath for LimitsElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
self.body().layout_math(ctx)
}
diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs
index fe7d2d1e..3726aa15 100644
--- a/library/src/math/delimited.rs
+++ b/library/src/math/delimited.rs
@@ -39,6 +39,7 @@ pub struct LrElem {
}
impl LayoutMath for LrElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let mut body = self.body();
if let Some(elem) = body.to::<LrElem>() {
diff --git a/library/src/math/frac.rs b/library/src/math/frac.rs
index 7520e10d..f93ee888 100644
--- a/library/src/math/frac.rs
+++ b/library/src/math/frac.rs
@@ -30,6 +30,7 @@ pub struct FracElem {
}
impl LayoutMath for FracElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(ctx, &self.num(), &self.denom(), false, self.span())
}
diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs
index 368cd5c4..2243eb38 100644
--- a/library/src/math/matrix.rs
+++ b/library/src/math/matrix.rs
@@ -33,6 +33,7 @@ pub struct VecElem {
}
impl LayoutMath for VecElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let delim = self.delim(ctx.styles());
let frame = layout_vec_body(ctx, &self.children(), Align::Center)?;
@@ -115,6 +116,7 @@ pub struct MatElem {
}
impl LayoutMath for MatElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let delim = self.delim(ctx.styles());
let frame = layout_mat_body(ctx, &self.rows())?;
@@ -161,6 +163,7 @@ pub struct CasesElem {
}
impl LayoutMath for CasesElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let delim = self.delim(ctx.styles());
let frame = layout_vec_body(ctx, &self.children(), Align::Left)?;
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 48fe52d2..63bfdbbe 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -173,6 +173,7 @@ impl Synthesize for EquationElem {
}
impl Show for EquationElem {
+ #[tracing::instrument(name = "EquationElem::show", skip_all)]
fn show(&self, _: &mut Vt, styles: StyleChain) -> SourceResult<Content> {
let mut realized = self.clone().pack().guarded(Guard::Base(Self::func()));
if self.block(styles) {
@@ -193,6 +194,7 @@ impl Finalize for EquationElem {
}
impl Layout for EquationElem {
+ #[tracing::instrument(name = "EquationElem::layout", skip_all)]
fn layout(
&self,
vt: &mut Vt,
@@ -340,12 +342,14 @@ pub trait LayoutMath {
}
impl LayoutMath for EquationElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
self.body().layout_math(ctx)
}
}
impl LayoutMath for Content {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
// Directly layout the body of nested equations instead of handling it
// like a normal equation so that things like this work:
diff --git a/library/src/math/op.rs b/library/src/math/op.rs
index 5ea4519c..699d326a 100644
--- a/library/src/math/op.rs
+++ b/library/src/math/op.rs
@@ -34,6 +34,7 @@ pub struct OpElem {
}
impl LayoutMath for OpElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let fragment =
ctx.layout_text(&TextElem::new(self.text()).spanned(self.span()))?;
diff --git a/library/src/math/root.rs b/library/src/math/root.rs
index cc48cd74..8b272160 100644
--- a/library/src/math/root.rs
+++ b/library/src/math/root.rs
@@ -39,6 +39,7 @@ pub struct RootElem {
}
impl LayoutMath for RootElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(ctx, self.index(ctx.styles()).as_ref(), &self.radicand(), self.span())
}
diff --git a/library/src/math/style.rs b/library/src/math/style.rs
index 2cd29175..eb6472ee 100644
--- a/library/src/math/style.rs
+++ b/library/src/math/style.rs
@@ -199,6 +199,7 @@ pub struct MathStyleElem {
}
impl LayoutMath for MathStyleElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
let mut style = ctx.style;
if let Some(variant) = self.variant(StyleChain::default()) {
diff --git a/library/src/math/underover.rs b/library/src/math/underover.rs
index a8d7b71c..5282c6dc 100644
--- a/library/src/math/underover.rs
+++ b/library/src/math/underover.rs
@@ -21,6 +21,7 @@ pub struct UnderlineElem {
}
impl LayoutMath for UnderlineElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(ctx, &self.body(), &None, '\u{305}', LINE_GAP, false, self.span())
}
@@ -43,6 +44,7 @@ pub struct OverlineElem {
}
impl LayoutMath for OverlineElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(ctx, &self.body(), &None, '\u{332}', LINE_GAP, true, self.span())
}
@@ -69,6 +71,7 @@ pub struct UnderbraceElem {
}
impl LayoutMath for UnderbraceElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(
ctx,
@@ -103,6 +106,7 @@ pub struct OverbraceElem {
}
impl LayoutMath for OverbraceElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(
ctx,
@@ -137,6 +141,7 @@ pub struct UnderbracketElem {
}
impl LayoutMath for UnderbracketElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(
ctx,
@@ -171,6 +176,7 @@ pub struct OverbracketElem {
}
impl LayoutMath for OverbracketElem {
+ #[tracing::instrument(skip(ctx))]
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
layout(
ctx,