diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-14 15:24:59 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-14 15:55:39 +0200 |
| commit | 6ae6d86b9c6fefe6c5379ac1b20ea90634c09c81 (patch) | |
| tree | 2504c3b46807be148b9efbadf9b23e57bb77b8f3 /src/library/elements.rs | |
| parent | fcb4e451186067cdf6efe3c14cbfa7561b366a6c (diff) | |
Separate type for string values
Diffstat (limited to 'src/library/elements.rs')
| -rw-r--r-- | src/library/elements.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/library/elements.rs b/src/library/elements.rs index f0e36994..1ad56a81 100644 --- a/src/library/elements.rs +++ b/src/library/elements.rs @@ -10,8 +10,8 @@ use crate::layout::{ }; /// `image`: An image. -pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { - let path = args.expect::<Spanned<EcoString>>("path to image file")?; +pub fn image(ctx: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { + let path = args.expect::<Spanned<Str>>("path to image file")?; let width = args.named("width")?; let height = args.named("height")?; @@ -29,7 +29,7 @@ pub fn image(ctx: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { } /// `rect`: A rectangle with optional content. -pub fn rect(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { +pub fn rect(_: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { let width = args.named("width")?; let height = args.named("height")?; let fill = args.named("fill")?; @@ -38,7 +38,7 @@ pub fn rect(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { } /// `square`: A square with optional content. -pub fn square(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { +pub fn square(_: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { let length = args.named::<Length>("length")?.map(Linear::from); let width = match length { Some(length) => Some(length), @@ -80,7 +80,7 @@ fn rect_impl( } /// `ellipse`: An ellipse with optional content. -pub fn ellipse(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { +pub fn ellipse(_: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { let width = args.named("width")?; let height = args.named("height")?; let fill = args.named("fill")?; @@ -89,7 +89,7 @@ pub fn ellipse(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { } /// `circle`: A circle with optional content. -pub fn circle(_: &mut EvalContext, args: &mut FuncArgs) -> TypResult<Value> { +pub fn circle(_: &mut EvalContext, args: &mut Arguments) -> TypResult<Value> { let diameter = args.named("radius")?.map(|r: Length| 2.0 * Linear::from(r)); let width = match diameter { None => args.named("width")?, |
