Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cofibrant/trait-eval
/ types & classes
Types & classes
21 in github.com/cofibrant/trait-eval
⨍
Functions
1
◇
Types & classes
21
Interface
AndAlso
# Logical And A logical and operator for all you conjunctive needs. It would short circuit if that were possible, but here we are. ```rust # use tra
src/lib.rs:502
Interface
Bool
The bool type (`true`, `false`)
src/lib.rs:137
Interface
Equals
# Equality testing ```rust # use trait_eval::*; type TwoPlusTwo = <Two as Plus<Two>>::Result; type IsFour = <TwoPlusTwo as Equals<Four>>::Result; ass
src/lib.rs:359
Interface
Eval
# `trait_eval` to Rust conversion Here's a magic trait for getting your data out of `trait_eval` and into Rust. Don't worry - it doesn't actually eva
src/lib.rs:550
Interface
Fact
# Factorial! Did I hear shouting? Or was that just this epic compile-time factorial operator?! ```rust # #![recursion_limit = "20000000"] # use trai
src/lib.rs:245
Class
False
False (`false`)
src/lib.rs:145
Interface
Fib
# Built-in Fibonacci sequence Of course, every programmer uses the Fibonacci sequence on the daily, so we've built it right into the library. Now you
src/lib.rs:435
Interface
FibRecurse
src/lib.rs:444
Interface
If
# Conditional execution! The syntax is kind of clunky, but write `<(Then, Else) as If<Cond>::Result`. The condition can be any boolean expression bui
src/lib.rs:161
Interface
LessThan
# Integer comparison I honestly can't be bothered to implement `<=`, `>=` and `>`, so you're just going to have to make do with this and [`Not`](trai
src/lib.rs:393
Interface
Minus
# Saturating Subtraction It's 2:30AM and I've completely run out of snappy sales pitches. It's subtraction - wow. ```rust # use trait_eval::*; asser
src/lib.rs:302
Interface
Mod
# Remainders GCD is left as an exercise for the reader... ```rust # use trait_eval::*; assert_eq!(<Five as Mod<Three>>::Result::eval(), 2); assert_e
src/lib.rs:329
Interface
Nat
The type of natural numbers (`0..`)
src/lib.rs:96
Interface
Not
# Logical Not Negate any boolean you like at compile-time. (`¬¬(P V ¬P)` - just saying.) ```rust # use trait_eval::*; assert_eq!(<True as Not>::Res
src/lib.rs:478
Interface
OrElse
# Logical Or A logical or operator for all you disjunctive needs. It would short circuit if that were possible, but here we are. ```rust # use trait
src/lib.rs:530
Interface
Plus
# Addition Addition at compile-time. That's right. Only limited by your imagination (and maybe your `#[recursion_limit]`). ```rust # use trait_eval:
src/lib.rs:185
Interface
Pred
# Saturating Decrement See, this is engineering at its finest, compile-time execution and no undefined behaviour! ```rust # use trait_eval::*; asser
src/lib.rs:279
Class
Succ
# Peano-style increment operator ```rust # use trait_eval::*; assert_eq!(Succ::<Six>::eval(), 7); ```
src/lib.rs:132
Interface
Times
# Multiplication It's time to get timesing at compile-time! That sounded way cooler in my head. ```rust # use trait_eval::*; assert_eq!(<Four as Tim
src/lib.rs:212
Class
True
True (`true`)
src/lib.rs:140
Class
Zero
Constant zero (`0`)
src/lib.rs:99