Aren't you müde from writing Rust programs in English? Do you like saying "scheiße" a lot? Would you like to try something different, in an exotic and funny-sounding language? Would you want to bring some German touch to your programs?
Rost (German for Rust) is here to save your day. It allows you to write Rust programs in German, using German keywords, German function names, German idioms.
You don't feel at ease using only German words? Don't worry! German Rust is fully compatible with English-Rust, so you can mix both at your convenience.
Rost targets Rust 2024 and requires Rust 1.85 or newer. It is a playful experiment, but ordinary Rust and German Rust remain fully interoperable.
Add Rost to your project:
[dependencies]
rost = { git = "https://github.com/michidk/rost" }Then wrap German Rust in the rost! macro:
rost::rost! {
fk haupt() {
lass nachricht = "Hallo, Welt!";
ausgabe!("{nachricht}");
}
}Here is a larger example:
rost::rost! {
benutze standardbibliothek::sammlungen::Wörterbuch als Wöbu;
eigenschaft SchlüsselWert {
fk schreibe(&selbst, schlsl: Zeichenkette, wert: Zeichenkette);
fk lese(&selbst, schlsl: &Zeichenstrang) -> Ergebnis<Möglichkeit<Zeichenkette>, Zeichenkette>;
}
benutze standardbibliothek::synchronisierung::{VerzögerteSperre, Sperre};
statisch WÖRTERBUCH: VerzögerteSperre<Sperre<Wöbu<Zeichenkette, Zeichenkette>>> =
VerzögerteSperre::neu(|| Sperre::neu(Wöbu::neu()));
struktur Konkret;
umstz SchlüsselWert für Konkret {
fk schreibe(&selbst, schlsl: Zeichenkette, wert: Zeichenkette) {
lass änd wöbu = WÖRTERBUCH.sperren().erwarte("Wörterbuchsperre wurde vergiftet");
wöbu.einfügen(schlsl, wert);
}
fk lese(&selbst, schlsl: &Zeichenstrang) -> Ergebnis<Möglichkeit<Zeichenkette>, Zeichenkette> {
lass wöbu = WÖRTERBUCH.sperren()
.ordne_fehler_zu(|_| Zeichenkette::von("Wörterbuchsperre wurde vergiftet"))?;
Gut(wöbu.hole(schlsl).geklont())
}
}
}See the examples to get a rough sense of the whole syntax. Gut so!
The French and Dutch can do it, so we can as well! See Rouille's Other languages section for the full collection.
First of all, vielen Dank for considering participating to this joke, the
German government will thank you later! Feel free to add a few identifiers
here and there, and open a pull request against the hauptzweig (German for
main branch). The initial translation was made by Shemnei and michidk.
WTFPL. The logo was created with ChatGPT and does not fall under this license.
