summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock18
-rw-r--r--Cargo.toml2
-rw-r--r--crates/typst/src/foundations/plugin.rs2
-rw-r--r--crates/typst/src/model/bibliography.rs6
-rw-r--r--crates/typst/src/visualize/image/mod.rs4
-rw-r--r--crates/typst/src/visualize/image/raster.rs2
-rw-r--r--crates/typst/src/visualize/image/svg.rs4
7 files changed, 24 insertions, 14 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 262d8972..f20c5270 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -393,18 +393,18 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "comemo"
version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf5705468fa80602ee6a5f9318306e6c428bffd53e43209a78bc05e6e667c6f4"
+source = "git+https://github.com/typst/comemo?rev=ddb3773#ddb3773d062369e120d09c9a0a7909faf29d8fe1"
dependencies = [
"comemo-macros",
+ "once_cell",
+ "parking_lot",
"siphasher 1.0.0",
]
[[package]]
name = "comemo-macros"
version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54af6ac68ada2d161fa9cc1ab52676228e340866d094d6542107e74b82acc095"
+source = "git+https://github.com/typst/comemo?rev=ddb3773#ddb3773d062369e120d09c9a0a7909faf29d8fe1"
dependencies = [
"proc-macro2",
"quote",
@@ -1567,6 +1567,16 @@ dependencies = [
]
[[package]]
+name = "parking_lot"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
name = "parking_lot_core"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 1ddd504f..2163d7c0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -36,7 +36,7 @@ clap = { version = "4.4", features = ["derive", "env"] }
clap_complete = "4.2.1"
clap_mangen = "0.2.10"
codespan-reporting = "0.11"
-comemo = "0.3.1"
+comemo = { git = "https://github.com/typst/comemo", rev = "ddb3773" }
csv = "1"
dirs = "5"
ecow = { version = "0.2", features = ["serde"] }
diff --git a/crates/typst/src/foundations/plugin.rs b/crates/typst/src/foundations/plugin.rs
index 89237f94..b7e52e72 100644
--- a/crates/typst/src/foundations/plugin.rs
+++ b/crates/typst/src/foundations/plugin.rs
@@ -167,7 +167,7 @@ impl Plugin {
impl Plugin {
/// Create a new plugin from raw WebAssembly bytes.
#[comemo::memoize]
- pub fn new(bytes: Bytes) -> StrResult<Self> {
+ pub fn new(bytes: Bytes) -> StrResult<Plugin> {
let engine = wasmi::Engine::default();
let module = wasmi::Module::new(&engine, bytes.as_slice())
.map_err(|err| format!("failed to load WebAssembly module ({err})"))?;
diff --git a/crates/typst/src/model/bibliography.rs b/crates/typst/src/model/bibliography.rs
index cd1b19f5..94e6aafa 100644
--- a/crates/typst/src/model/bibliography.rs
+++ b/crates/typst/src/model/bibliography.rs
@@ -489,7 +489,7 @@ impl CslStyle {
/// Load a built-in CSL style.
#[comemo::memoize]
- pub fn from_name(name: &str) -> StrResult<Self> {
+ pub fn from_name(name: &str) -> StrResult<CslStyle> {
match hayagriva::archive::ArchivedStyle::by_name(name).map(ArchivedStyle::get) {
Some(citationberg::Style::Independent(style)) => Ok(Self {
name: Some(name.into()),
@@ -501,7 +501,7 @@ impl CslStyle {
/// Load a CSL style from file contents.
#[comemo::memoize]
- pub fn from_data(data: &Bytes) -> StrResult<Self> {
+ pub fn from_data(data: &Bytes) -> StrResult<CslStyle> {
let text = std::str::from_utf8(data.as_slice()).map_err(FileError::from)?;
citationberg::IndependentStyle::from_xml(text)
.map(|style| Self { name: None, style: Arc::new(Prehashed::new(style)) })
@@ -589,7 +589,7 @@ impl Works {
pub fn generate(
world: Tracked<dyn World + '_>,
introspector: Tracked<Introspector>,
- ) -> StrResult<Arc<Self>> {
+ ) -> StrResult<Arc<Works>> {
let mut generator = Generator::new(world, introspector)?;
let rendered = generator.drive();
let works = generator.display(&rendered)?;
diff --git a/crates/typst/src/visualize/image/mod.rs b/crates/typst/src/visualize/image/mod.rs
index d883dab9..a10f7e7b 100644
--- a/crates/typst/src/visualize/image/mod.rs
+++ b/crates/typst/src/visualize/image/mod.rs
@@ -325,7 +325,7 @@ impl Image {
data: Bytes,
format: ImageFormat,
alt: Option<EcoString>,
- ) -> StrResult<Self> {
+ ) -> StrResult<Image> {
let kind = match format {
ImageFormat::Raster(format) => {
ImageKind::Raster(RasterImage::new(data, format)?)
@@ -346,7 +346,7 @@ impl Image {
alt: Option<EcoString>,
world: Tracked<dyn World + '_>,
families: &[String],
- ) -> StrResult<Self> {
+ ) -> StrResult<Image> {
let kind = match format {
ImageFormat::Raster(format) => {
ImageKind::Raster(RasterImage::new(data, format)?)
diff --git a/crates/typst/src/visualize/image/raster.rs b/crates/typst/src/visualize/image/raster.rs
index 5bd1ad10..98ba8fc0 100644
--- a/crates/typst/src/visualize/image/raster.rs
+++ b/crates/typst/src/visualize/image/raster.rs
@@ -27,7 +27,7 @@ struct Repr {
impl RasterImage {
/// Decode a raster image.
#[comemo::memoize]
- pub fn new(data: Bytes, format: RasterFormat) -> StrResult<Self> {
+ pub fn new(data: Bytes, format: RasterFormat) -> StrResult<RasterImage> {
fn decode_with<'a, T: ImageDecoder<'a>>(
decoder: ImageResult<T>,
) -> ImageResult<(image::DynamicImage, Option<Vec<u8>>)> {
diff --git a/crates/typst/src/visualize/image/svg.rs b/crates/typst/src/visualize/image/svg.rs
index d7289367..a4cf3807 100644
--- a/crates/typst/src/visualize/image/svg.rs
+++ b/crates/typst/src/visualize/image/svg.rs
@@ -28,7 +28,7 @@ struct Repr {
impl SvgImage {
/// Decode an SVG image without fonts.
#[comemo::memoize]
- pub fn new(data: Bytes) -> StrResult<Self> {
+ pub fn new(data: Bytes) -> StrResult<SvgImage> {
let opts = usvg::Options::default();
let tree = usvg::Tree::from_data(&data, &opts).map_err(format_usvg_error)?;
Ok(Self(Arc::new(Repr {
@@ -46,7 +46,7 @@ impl SvgImage {
data: Bytes,
world: Tracked<dyn World + '_>,
families: &[String],
- ) -> StrResult<Self> {
+ ) -> StrResult<SvgImage> {
// Disable usvg's default to "Times New Roman". Instead, we default to
// the empty family and later, when we traverse the SVG, we check for
// empty and non-existing family names and replace them with the true