Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the signature of World::main #4531

Merged
merged 5 commits into from
Jul 14, 2024
Merged

Conversation

Myriad-Dreamin
Copy link
Contributor

The current World::main cannot process the case when the main source file may be gone or invalid at some time well. For example, typst-cli has to always add an extra checking before trapped into typst::compile.

Therefore, we would like to change the the signature of World::main to fn main(&self) -> FileId. This decouples the world APIs a bit and makes it impossible to have a mismatch between world.main() and world.source(world.main().id()) (which would be a logic error). The PR itself also proves it actually makes life of downstreams simpler.

crates/typst/src/lib.rs Outdated Show resolved Hide resolved
@laurmaedje
Copy link
Member

Thanks!

@laurmaedje laurmaedje added this pull request to the merge queue Jul 14, 2024
Merged via the queue into typst:main with commit a3f3a1a Jul 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants