My rust sugar lib - Wibr

English
I'd like to share my Rust library wibr and its first release, v0.1.0.

The idea is simple: there's a set of tiny patterns you write dozens of times a day in Rust — .to_string(), .into(), if/else as an expression, unwrapping Option/Result with a fallback, boilerplate constructors — and none of them have a one-word shorthand. wibr is a small set of macros and derives that closes that gap, with zero implicit behavior — every macro expands to exactly the code you'd write by hand, nothing hidden:

Conversion shorthands (s!, io!): One-word replacements for .to_string() and .into(). No trait magic, expands directly to the same call.
New derive: Generates a new(...) constructor from your struct's fields, in declaration order. No manual boilerplate, no typos in field order.
Make derive: A more convenient constructor. Mark a field #[None] or #[Some(expr)] and it's excluded from new()'s arguments entirely — the constructor only asks for what actually varies per instance.
Ternary operators (iff!, get!, okk!): Collapse if a { b } else { c }, if let Some(b) = a { b } else { c }, and if let Ok(b) = a { b } else { c } into single expressions.

That's it — pure syntactic sugar for convenience, nothing implicit, nothing you couldn't write yourself in one more line.

Русский
Хочу поделиться своей библиотекой wibr и её первым релизом v0.1.0.

Идея простая: в Rust есть набор мелких паттернов, которые пишешь по десять раз на дню — .to_string(), .into(), if/else как выражение, разворачивание Option/Result с фолбэком, конструкторы-бойлерплейт — и ни у одного из них нет однословного сокращения. wibr — небольшой набор макросов и дерайвов, закрывающий этот пробел, без единого неявного поведения — каждый макрос разворачивается ровно в тот код, который вы написали бы руками, ничего не скрыто:

Сокращения для конвертаций (s!, io!): Однословная замена .to_string() и .into(). Никакой магии трейтов, разворачивается напрямую в тот же вызов.
Дерайв New: Генерирует конструктор new(...) по полям структуры, в порядке объявления. Без ручного бойлерплейта и без ошибок в порядке полей.
Дерайв Make: Более удобный конструктор. Помечаете поле #[None] или #[Some(expr)] — и оно полностью исключается из аргументов new(). Конструктор просит только то, что реально меняется от экземпляра к экземпляру.
Тернарные операторы (iff!, get!, okk!): Сворачивают if a { b } else { c }, if let Some(b) = a { b } else { c } и if let Ok(b) = a { b } else { c } в одно выражение.

Вот и всё — чистый синтаксический сахар для удобства, ничего неявного, ничего такого, что вы не написали бы сами одной строкой больше.

GitHub:GitHub - Honami333/Wibr: What ought to be in Rust by default, but the developers decided otherwise. Micro syntactic sugar just for you. · GitHub
Crates.io: crates.io: Rust Package Registry
Telegram Channel: Telegram: View @cat_garden_news