MCPcopy Create free account

hub / github.com/cofibrant/trait-eval / types & classes

Types & classes21 in github.com/cofibrant/trait-eval

InterfaceAndAlso
# 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
InterfaceBool
The bool type (`true`, `false`)
src/lib.rs:137
InterfaceEquals
# 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
InterfaceEval
# `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
InterfaceFact
# 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
ClassFalse
False (`false`)
src/lib.rs:145
InterfaceFib
# 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
InterfaceFibRecurse
src/lib.rs:444
InterfaceIf
# 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
InterfaceLessThan
# 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
InterfaceMinus
# 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
InterfaceMod
# 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
InterfaceNat
The type of natural numbers (`0..`)
src/lib.rs:96
InterfaceNot
# 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
InterfaceOrElse
# 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
InterfacePlus
# 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
InterfacePred
# 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
ClassSucc
# Peano-style increment operator ```rust # use trait_eval::*; assert_eq!(Succ::<Six>::eval(), 7); ```
src/lib.rs:132
InterfaceTimes
# 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
ClassTrue
True (`true`)
src/lib.rs:140
ClassZero
Constant zero (`0`)
src/lib.rs:99