diff options
| author | Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> | 2024-07-14 21:14:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-14 13:14:21 +0000 |
| commit | a3f3a1a83330e3fe9a686fbe4c0eda9f1e9e99b2 (patch) | |
| tree | 0c6b10649101d75573e453498901907bdec5a8b3 /crates/typst-syntax | |
| parent | 4d8976b619fbb2ab19c1e46fccbca4294c0c2d0b (diff) | |
Change the signature of `World::main` (#4531)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-syntax')
| -rw-r--r-- | crates/typst-syntax/src/file.rs | 5 | ||||
| -rw-r--r-- | crates/typst-syntax/src/path.rs | 5 |
2 files changed, 10 insertions, 0 deletions
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 { |
