A simple, C-like, ternary operator for cleaner syntax.

Related tags

Command-line terny
Overview

Github Crates.io Unlicense Docs.rs

A simple ternary operator macro in rust. the iff! macro is the only item exported by this crate, it simply takes three expressions, seperated by ? and :, and expands them info an if else statement.

Usage


iff!( condition
 ? expressionA
 : expressionB );

expands to:

if condition {
    expressionA
} else {
    expressionB
}

It can also be used in assignment:

let value = iff!(condition
 ? expressionA
 : expressionB );

It can also be used inline:

let value = iff!(condition ? exressionA : expressionB);

It may also be nested, although the code starts to look less clean at this point

let value = iff!(conditionA ? iff!(conditionB ? expressionA : expressionB) : expressionC);

Currently using the ? operator within iff is not possible, as there is no way (that I know of) to check for whitespace. This should be changeable once Tracking issue 54725 becomes stable.

You might also like...
Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history
Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history

eva simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history installation Homebrew $ brew install eva crates.io $ car

A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

A cat(1) clone with syntax highlighting and Git integration.
A cat(1) clone with syntax highlighting and Git integration.

A cat(1) clone with syntax highlighting and Git integration. Key Features • How To Use • Installation • Customization • Project goals, alternatives [中

Rust syntax in Turkish
Rust syntax in Turkish

pas pas (Turkish for Rust) allows to write Rust programs in Turkish, using Turkish keywords and function names, adapted from the original French imple

A syntax-highlighting pager for git, diff, and grep output
A syntax-highlighting pager for git, diff, and grep output

Get Started Install delta and add this to your ~/.gitconfig: [core] pager = delta [interactive] diffFilter = delta --color-only [delta]

A syntax highlighter for Node powered by Tree Sitter. Written in Rust.

tree-sitter-highlight A syntax highlighter for Node.js powered by Tree Sitter. Written in Rust. Usage The following will output HTML: const treeSitter

Notes on learning the Rust programming language syntax.

notes-on-rust Notes on learning the Rust programming language syntax. Resources https://www.rust-lang.org/learn/get-started https://doc.rust-lang.org/

🌴 Syntax highlighting in Rust.

🌴 HL (WIP) Syntax highlighting written in Rust. The project is designed to generate html syntax highlighting for the given file. This software is ins

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting
Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Releases(v0.2.0)
Owner
KaitlynEthylia
Hey UwU <3 Yeah I do some shit, and then I dump it here. Idk ¯\_ (ツ)_/¯
KaitlynEthylia
A prolog like syntax for egg

egglog Using the egg library with a file format and semantics similar to datalog. Explanatory blog posts: https://www.philipzucker.com/egglog-checkpoi

Philip Zucker 40 Dec 1, 2022
Valq - macros for querying and extracting value from structured data by JavaScript-like syntax

valq   valq provides a macro for querying and extracting value from structured data in very concise manner, like the JavaScript syntax. Look & Feel: u

Takumi Fujiwara 24 Dec 21, 2022
Rust Server Components. JSX-like syntax and async out of the box.

RSCx - Rust Server Components RSCx is a server-side HTML rendering engine library with a neat developer experience and great performance. Features: al

Antonio Pitasi 21 Sep 19, 2023
H2O Open Source Kubernetes operator and a command-line tool to ease deployment (and undeployment) of H2O open-source machine learning platform H2O-3 to Kubernetes.

H2O Kubernetes Repository with official tools to aid the deployment of H2O Machine Learning platform to Kubernetes. There are two essential tools to b

H2O.ai 16 Nov 12, 2022
IntMaxRollup operator node & cli tools.

Intmax Rollup Operator Int max operator node Prepara Install rustup. rustup override set nightly

null 5 Jul 26, 2022
Expand your possibilities with the Try ? Operator

Expand your possibilities with the Try ? Operator Have you ever found yourself writing a function which may return early based on some condition? fn m

EC 1 Feb 1, 2022
⏱ Kubernetes operator that allows to set maximum lifetime for pods

Pod Lifetime Limiter Hi! ?? So you deal with a crappy application which stops working after some period of time and you want to restart it every N hou

Viktor 27 Sep 8, 2022
Set of tools that make it easier for the operator to manage a TAPLE network.

⚠️ TAPLE is in early development and should not be used in production ⚠️ TAPLE Tools TAPLE (pronounced T+ ?? ['tapəl]) stands for Tracking (Autonomous

Open Canarias 5 Jan 25, 2023
Rust based Kubernetes Operator to deploy K8s objects minimally.

kube-nimble nimble /ˈnɪmbl/ - quick and light in movement or action; agile. This project began from a place of curiosity about Kubernetes CRDs and the

Meet Vasani 3 Feb 26, 2024
Kubernetes operator for declaratively deploying wasmCloud applications (via wadm) and hosts on Kubernetes.

wasmcloud-operator An operator for managing a set of wasmCloud hosts running on Kubernetes and manage wasmCloud applications using wadm. The goal is t

wasmcloud 11 May 1, 2024