Skip to content

Add a reset API#78

Open
LaurenzV wants to merge 1 commit into
typst:mainfrom
LaurenzV:reset
Open

Add a reset API#78
LaurenzV wants to merge 1 commit into
typst:mainfrom
LaurenzV:reset

Conversation

@LaurenzV
Copy link
Copy Markdown
Contributor

@LaurenzV LaurenzV commented Apr 26, 2026

This allows users to reset chunks, making it possible to reuse the inner allocations. While I don't have a specific need for this now, I think it could come in handy in the future.

I'm not sure if the reset method should take Settings as well so that they can be changed if desired. Or maybe a reset_with_settings method?

@saecki
Copy link
Copy Markdown
Member

saecki commented Apr 26, 2026

Maybe the settings could be changed arbitrarily, then the combinations of constructors could be reduced and instead a builder method and a setter (and even a getter?) could be exposed.

@laurmaedje
Copy link
Copy Markdown
Member

I'm fine with this, but would try avoid it taking Setting or having reset_with_settings. Maybe a builder style API would work, but that could be looked into separately.

CI is failing though due to formatting.

@saecki
Copy link
Copy Markdown
Member

saecki commented Apr 27, 2026

A separate bulider type could be circumvented if we allow changing the Settings arbitrarily, which I think would be nice anyway, because then it could just be an inherent method on Chunk.

But yeah, that doesn't need to happen in this PR :)

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.

3 participants