this post was submitted on 11 May 2024
23 points (100.0% liked)

Rust

5960 readers
3 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

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.

top 3 comments
sorted by: hot top controversial new old
[–] magikmw@lemm.ee 5 points 6 months ago (2 children)

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

Also out of scope of OP, is typst in anyway capable of typesetting music notation? I never used LaTeX so I have no idea about that either or if it's even feasible.

[–] 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 ^^).

[–] rycee@lemmy.world 3 points 6 months ago

I don't typeset music myself but I've heard that LilyPond is very good. It is based on LaTeX.