An open API service indexing awesome lists of open source software.

https://github.com/lambda-fairy/if_chain

Macro for writing nested `if let` expressions
https://github.com/lambda-fairy/if_chain

macro rust

Last synced: 9 months ago
JSON representation

Macro for writing nested `if let` expressions

Awesome Lists containing this project

README

          

# if_chain

[![CI](https://github.com/lambda-fairy/if_chain/actions/workflows/ci.yml/badge.svg)](https://github.com/lambda-fairy/if_chain/actions/workflows/ci.yml) [![Cargo](https://img.shields.io/crates/v/if_chain.svg)](https://crates.io/crates/if_chain)

This crate provides a single macro called `if_chain!`.

`if_chain!` lets you write long chains of nested `if` and `if let` statements without the associated rightward drift. It also supports multiple patterns (e.g. `if let Foo(a) | Bar(a) = b`) in places where Rust would normally not allow them.

For more information on this crate, see the [documentation](https://docs.rs/if_chain) and associated [blog post](https://lambda.xyz/blog/if-chain).