From a3f3a1a83330e3fe9a686fbe4c0eda9f1e9e99b2 Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> Date: Sun, 14 Jul 2024 21:14:21 +0800 Subject: Change the signature of `World::main` (#4531) Co-authored-by: Laurenz --- crates/typst-syntax/src/file.rs | 5 +++++ crates/typst-syntax/src/path.rs | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'crates/typst-syntax') diff --git a/crates/typst-syntax/src/file.rs b/crates/typst-syntax/src/file.rs index 356337f3..89aaa55e 100644 --- a/crates/typst-syntax/src/file.rs +++ b/crates/typst-syntax/src/file.rs @@ -91,6 +91,11 @@ impl FileId { Self::new(self.package().cloned(), self.vpath().join(path)) } + /// The same file location, but with a different extension. + pub fn with_extension(&self, extension: &str) -> Self { + Self::new(self.package().cloned(), self.vpath().with_extension(extension)) + } + /// Construct from a raw number. pub(crate) const fn from_raw(v: u16) -> Self { Self(v) diff --git a/crates/typst-syntax/src/path.rs b/crates/typst-syntax/src/path.rs index b561128c..6c625642 100644 --- a/crates/typst-syntax/src/path.rs +++ b/crates/typst-syntax/src/path.rs @@ -85,6 +85,11 @@ impl VirtualPath { Self::new(path) } } + + /// The same path, but with a different extension. + pub fn with_extension(&self, extension: &str) -> Self { + Self(self.0.with_extension(extension)) + } } impl Debug for VirtualPath { -- cgit v1.2.3