diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-04 19:21:35 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-04 19:21:35 +0200 |
| commit | f4460f8abd7dee1806cf59b4d3777581a6ed154a (patch) | |
| tree | 8e591d253a537a76f8c309e23b09bf7a9a762fd5 /src/library | |
| parent | 0f7c70fd93db23ec866ae13aa2f146b7787afabf (diff) | |
Style nits 🎈
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/align.rs | 2 | ||||
| -rw-r--r-- | src/library/boxed.rs | 2 | ||||
| -rw-r--r-- | src/library/color.rs | 2 | ||||
| -rw-r--r-- | src/library/font.rs | 4 | ||||
| -rw-r--r-- | src/library/mod.rs | 4 | ||||
| -rw-r--r-- | src/library/page.rs | 10 | ||||
| -rw-r--r-- | src/library/spacing.rs | 6 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/library/align.rs b/src/library/align.rs index c3512b7f..0c145e5f 100644 --- a/src/library/align.rs +++ b/src/library/align.rs @@ -14,7 +14,7 @@ use super::*; /// - `vertical`: Any of `top`, `bottom` or `center`. /// /// There may not be two alignment specifications for the same axis. -pub async fn align(mut args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn align(mut args: ValueDict, ctx: &mut LayoutContext) -> Value { let content = args.take::<SynTree>(); let h = args.take_key::<Spanned<SpecAlign>>("horizontal", &mut ctx.f); let v = args.take_key::<Spanned<SpecAlign>>("vertical", &mut ctx.f); diff --git a/src/library/boxed.rs b/src/library/boxed.rs index 94aac48a..c97df8d0 100644 --- a/src/library/boxed.rs +++ b/src/library/boxed.rs @@ -6,7 +6,7 @@ use crate::geom::Linear; /// # Keyword arguments /// - `width`: The width of the box (length or relative to parent's width). /// - `height`: The height of the box (length or relative to parent's height). -pub async fn boxed(mut args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn boxed(mut args: ValueDict, ctx: &mut LayoutContext) -> Value { let content = args.take::<SynTree>().unwrap_or_default(); let constraints = &mut ctx.constraints; diff --git a/src/library/color.rs b/src/library/color.rs index 631c3668..22029b1f 100644 --- a/src/library/color.rs +++ b/src/library/color.rs @@ -2,7 +2,7 @@ use super::*; use crate::color::RgbaColor; /// `rgb`: Create an RGB(A) color. -pub async fn rgb(mut args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn rgb(mut args: ValueDict, ctx: &mut LayoutContext) -> Value { let mut f = Feedback::new(); let r = args.expect::<Spanned<i64>>("red value", Span::ZERO, &mut f); diff --git a/src/library/font.rs b/src/library/font.rs index 40d8d30b..cfda3beb 100644 --- a/src/library/font.rs +++ b/src/library/font.rs @@ -49,7 +49,7 @@ use crate::geom::Linear; /// ```typst /// [font: "My Serif", serif] /// ``` -pub async fn font(mut args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn font(mut args: ValueDict, ctx: &mut LayoutContext) -> Value { let mut text = ctx.state.text.clone(); let mut updated_fallback = false; @@ -86,7 +86,7 @@ pub async fn font(mut args: DictValue, ctx: &mut LayoutContext) -> Value { text.variant.stretch = stretch; } - for (class, mut dict) in args.take_all_str::<DictValue>() { + for (class, mut dict) in args.take_all_str::<ValueDict>() { let fallback = dict .take_all_num_vals::<StringLike>() .map(|s| s.to_lowercase()) diff --git a/src/library/mod.rs b/src/library/mod.rs index 4db544e9..c6dfb758 100644 --- a/src/library/mod.rs +++ b/src/library/mod.rs @@ -14,7 +14,7 @@ pub use font::*; pub use page::*; pub use spacing::*; -use crate::eval::{FuncValue, Scope}; +use crate::eval::{Scope, ValueFunc}; use crate::prelude::*; macro_rules! std { @@ -30,7 +30,7 @@ macro_rules! std { macro_rules! wrap { ($func:expr) => { - FuncValue::new(|args, ctx| Box::pin($func(args, ctx))) + ValueFunc::new(|args, ctx| Box::pin($func(args, ctx))) }; } diff --git a/src/library/page.rs b/src/library/page.rs index 5fda9d5d..b557650b 100644 --- a/src/library/page.rs +++ b/src/library/page.rs @@ -1,7 +1,7 @@ use std::mem; use super::*; -use crate::eval::Abs; +use crate::eval::Absolute; use crate::geom::{Linear, Sides}; use crate::paper::{Paper, PaperClass}; @@ -19,7 +19,7 @@ use crate::paper::{Paper, PaperClass}; /// - `top`: The top margin (length or relative to height). /// - `bottom`: The bottom margin (length or relative to height). /// - `flip`: Flips custom or paper-defined width and height (boolean). -pub async fn page(mut args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn page(mut args: ValueDict, ctx: &mut LayoutContext) -> Value { let mut page = ctx.state.page.clone(); if let Some(paper) = args.take::<Paper>() { @@ -27,12 +27,12 @@ pub async fn page(mut args: DictValue, ctx: &mut LayoutContext) -> Value { page.size = paper.size(); } - if let Some(Abs(width)) = args.take_key::<Abs>("width", &mut ctx.f) { + if let Some(Absolute(width)) = args.take_key::<Absolute>("width", &mut ctx.f) { page.class = PaperClass::Custom; page.size.width = width; } - if let Some(Abs(height)) = args.take_key::<Abs>("height", &mut ctx.f) { + if let Some(Absolute(height)) = args.take_key::<Absolute>("height", &mut ctx.f) { page.class = PaperClass::Custom; page.size.height = height; } @@ -66,7 +66,7 @@ pub async fn page(mut args: DictValue, ctx: &mut LayoutContext) -> Value { } /// `pagebreak`: Ends the current page. -pub async fn pagebreak(args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn pagebreak(args: ValueDict, ctx: &mut LayoutContext) -> Value { args.unexpected(&mut ctx.f); Value::Commands(vec![BreakPage]) } diff --git a/src/library/spacing.rs b/src/library/spacing.rs index 91f407fe..9ca68263 100644 --- a/src/library/spacing.rs +++ b/src/library/spacing.rs @@ -6,7 +6,7 @@ use crate::layout::SpacingKind; /// /// # Positional arguments /// - The spacing (length or relative to font size). -pub async fn h(args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn h(args: ValueDict, ctx: &mut LayoutContext) -> Value { spacing(args, ctx, SpecAxis::Horizontal) } @@ -14,11 +14,11 @@ pub async fn h(args: DictValue, ctx: &mut LayoutContext) -> Value { /// /// # Positional arguments /// - The spacing (length or relative to font size). -pub async fn v(args: DictValue, ctx: &mut LayoutContext) -> Value { +pub async fn v(args: ValueDict, ctx: &mut LayoutContext) -> Value { spacing(args, ctx, SpecAxis::Vertical) } -fn spacing(mut args: DictValue, ctx: &mut LayoutContext, axis: SpecAxis) -> Value { +fn spacing(mut args: ValueDict, ctx: &mut LayoutContext, axis: SpecAxis) -> Value { let spacing = args.expect::<Linear>("spacing", Span::ZERO, &mut ctx.f); args.unexpected(&mut ctx.f); Value::Commands(if let Some(spacing) = spacing { |
