diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-23 12:15:38 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-23 12:20:47 +0100 |
| commit | a1d47695a2af5afa466c21ad812a1a8212780293 (patch) | |
| tree | a3210a23abbecaf69479f1da8772e4e3f7cce32d /library | |
| parent | 6e65ebf23641a755b0088569751c0b02e898f1e9 (diff) | |
Switch to ecow
Diffstat (limited to 'library')
| -rw-r--r-- | library/Cargo.toml | 1 | ||||
| -rw-r--r-- | library/src/compute/construct.rs | 6 | ||||
| -rw-r--r-- | library/src/compute/data.rs | 8 | ||||
| -rw-r--r-- | library/src/prelude.rs | 4 | ||||
| -rw-r--r-- | library/src/text/mod.rs | 1 | ||||
| -rw-r--r-- | library/src/text/shift.rs | 1 |
6 files changed, 10 insertions, 11 deletions
diff --git a/library/Cargo.toml b/library/Cargo.toml index af08d73b..d725a393 100644 --- a/library/Cargo.toml +++ b/library/Cargo.toml @@ -13,6 +13,7 @@ bench = false typst = { path = ".." } comemo = { git = "https://github.com/typst/comemo" } csv = "1" +ecow = { git = "https://github.com/typst/ecow" } hypher = "0.1" kurbo = "0.8" lipsum = { git = "https://github.com/reknih/lipsum" } diff --git a/library/src/compute/construct.rs b/library/src/compute/construct.rs index f540d828..a44d50c2 100644 --- a/library/src/compute/construct.rs +++ b/library/src/compute/construct.rs @@ -458,12 +458,12 @@ pub fn range(args: &mut Args) -> SourceResult<Value> { }; let mut x = start; - let mut seq = vec![]; + let mut array = Array::new(); while x.cmp(&end) == 0.cmp(&step) { - seq.push(Value::Int(x)); + array.push(Value::Int(x)); x += step; } - Ok(Value::Array(Array::from_vec(seq))) + Ok(Value::Array(array)) } diff --git a/library/src/compute/data.rs b/library/src/compute/data.rs index 5c0d4e64..c604be11 100644 --- a/library/src/compute/data.rs +++ b/library/src/compute/data.rs @@ -86,15 +86,15 @@ pub fn csv(vm: &Vm, args: &mut Args) -> SourceResult<Value> { } let mut reader = builder.from_reader(data.as_slice()); - let mut vec = vec![]; + let mut array = Array::new(); for result in reader.records() { let row = result.map_err(format_csv_error).at(span)?; - let array = row.iter().map(|field| Value::Str(field.into())).collect(); - vec.push(Value::Array(array)) + let sub = row.iter().map(|field| Value::Str(field.into())).collect(); + array.push(Value::Array(sub)) } - Ok(Value::Array(Array::from_vec(vec))) + Ok(Value::Array(array)) } /// The delimiter to use when parsing CSV files. diff --git a/library/src/prelude.rs b/library/src/prelude.rs index 5bb1d08a..c8f6fe97 100644 --- a/library/src/prelude.rs +++ b/library/src/prelude.rs @@ -8,6 +8,8 @@ pub use std::num::NonZeroUsize; #[doc(no_inline)] pub use comemo::{Track, Tracked, TrackedMut}; #[doc(no_inline)] +pub use ecow::{format_eco, EcoString}; +#[doc(no_inline)] pub use typst::diag::{bail, error, At, SourceResult, StrResult}; #[doc(no_inline)] pub use typst::doc::*; @@ -23,8 +25,6 @@ pub use typst::model::{ #[doc(no_inline)] pub use typst::syntax::{Span, Spanned}; #[doc(no_inline)] -pub use typst::util::{format_eco, EcoString}; -#[doc(no_inline)] pub use typst::World; #[doc(no_inline)] diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs index a87fba87..1ef32fa4 100644 --- a/library/src/text/mod.rs +++ b/library/src/text/mod.rs @@ -18,7 +18,6 @@ use std::borrow::Cow; use rustybuzz::Tag; use typst::font::{FontMetrics, FontStretch, FontStyle, FontWeight, VerticalFontMetric}; -use typst::util::EcoString; use crate::layout::ParNode; use crate::prelude::*; diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs index a7967650..d6809591 100644 --- a/library/src/text/shift.rs +++ b/library/src/text/shift.rs @@ -1,5 +1,4 @@ use typst::model::SequenceNode; -use typst::util::EcoString; use super::{variant, SpaceNode, TextNode, TextSize}; use crate::prelude::*; |
