KillTheMule

joined 1 year ago
[–] KillTheMule@programming.dev 3 points 3 days ago (1 children)

Yeah I was very happy to find that out. I was calling latex externally before, and there was a lot of pain interacting with the filesystem and temporary files. Now it all happens in-memory :)

[–] KillTheMule@programming.dev 3 points 3 days ago (3 children)

One thing that prevents me from letting users build their own templates is the scripting capabilities. A joker creating an endless loop could block the whole server.

I know little about servers, but can't you run the generation in a thread with a timeout or so? Or maybe compile to wasm and let the generation run on the users machines? I also know little about wasm, but I'd have guessed it has facilities to keep runtime and load under control.

What would be nice is a “safe” mode in which no access to the file system (include and sorts) and limited runtime makes it safe to let users build their own templates.

Ah, are you by chance shelling out to the typst binary? You can actually use typst as a library, and then you've got full control over the files involved, so it's "safe" in that respect.

 

Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use

Typst is awesome, in particular if you want to generate documents programmatically.

[–] KillTheMule@programming.dev 1 points 4 months ago

That might indeed be the case, I did not look very closely, but mlua has gotten quite some coverage (and I do like lua quite a bit), so I wanted it mentioned :)

[–] KillTheMule@programming.dev 2 points 4 months ago (2 children)

Seems to be missing mlua at least: https://github.com/mlua-rs/mlua

[–] KillTheMule@programming.dev 5 points 4 months ago

transitive performance benefits

I would have assumed the benchmark suite accounts for that, otherwise the results aren't quite as meaningfull really. Which ties back you your 2nd senctence: I certainly trust the rust team more than myself on these things :)

[–] KillTheMule@programming.dev 5 points 4 months ago (2 children)

only affect very select use cases

I did not read the whole conversation, but sorting seems a very common usecase (not mine, but seems to me a lot of people sort data), so this seems quite a broad improvement to me.

that is already perceived as a pain point

Note though, as is mentioned in the issue, that the survey showed people still prioritize runtime performance over compilation performance in general, so this tradeoff seems warranted.

the total regression is still minor

It's not unheard of that regressions can be unmade later on, so here's hoping :)

[–] KillTheMule@programming.dev 4 points 4 months ago (4 children)

The post mentioned that the introduction of these new algorithms brings compile-time improvements too, so how should I see this?

I assume you mean the first post of the PR? I'd assume it's simply outdated (or might not have been true to begin with). See https://github.com/rust-lang/rust/pull/124032#issuecomment-2181789935 for the perf run with this PR, it's showing quite a bit of regression.

[–] KillTheMule@programming.dev 5 points 4 months ago (6 children)

Alas, on the whole the compiler slowed down as a result of this. I think it's a worthy tradeoff though.

[–] KillTheMule@programming.dev 7 points 4 months ago (1 children)

No sarcasm, just an honest suggestion :)

[–] KillTheMule@programming.dev 18 points 4 months ago (4 children)

From the Fine Readme:

This project allows you to create games for the Playdate handheld gaming system in Rust lang.

You really should preface every announcement with something like this :)

[–] KillTheMule@programming.dev 6 points 5 months ago* (last edited 5 months ago) (9 children)

It's surprisingly simple: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f176852c61dcf0c3382f0ac97c26de03 As a side node, asking for a value, and then immediately calling to_string on it seems kinda hiding the allocation. I'd suggest let the user call to_string on it themselves.

(e) Changed it a bit to account for passing None as the third argument.

[–] KillTheMule@programming.dev 4 points 6 months ago

Did I get it right? The crate lets you directly input data into a typst document from an arbitrary struct?

Well, typst provides those means in itself, this crate just makes it easier to fulfill the necessary trait.

Also out of scope of OP, is typst in anyway capable of typesetting music notation?

I don't really think so. Music notation is also pretty specific, so I'd look into specialized software for that (although it might be theres a latex package, those things are everywhere ^^).

 

Hey all!

I've just published a small crate, and would like to take the occasion to not only announce this, but also make typst better known in the rust community, because I think it's awesome :)

What does this do?

It provides a derive macro to derive typst::foundations::IntoValue for a struct.

Why would I want that?

If you're using typst as a library, chances are you want to get data into your documents. Rather than using a templating library or rolling your own, I'd suggest using inputs (I'm still excited being made aware of that!), which implies making a Value out of your data. typst_macros provides the possibility to derive Cast, which includes the treasured IntoValue... for enums. This is a gap somewhat closed by this crate.

So what about this typst?

typst is a typesetting system (akin to LaTeX) written in Rust. The core and cli are licensed freely, and it is very useable up to the point that I personally don't use latex anymore, but have switched to typst. I'm personally ultra-fond of the ability to use typst as a library, which makes it perfect for apps that want to produce high-quality documents from user-provided data.

Any questions, comments, criticism, code reviews welcome! Also, give typst a shot.

 

... might be interesting for most people

view more: next ›