From 3a7fe94b328bdb1c1570370032d5f9763485d9be Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 26 Aug 2018 17:41:50 -0700 Subject: [PATCH] [types] Implement From for Bool --- types/src/bool.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/src/bool.rs b/types/src/bool.rs index 893a4f1..af71c89 100644 --- a/types/src/bool.rs +++ b/types/src/bool.rs @@ -25,6 +25,16 @@ impl fmt::Display for Bool { } } +impl From for Bool { + fn from(value: bool) -> Self { + if value { + Bool::True + } else { + Bool::False + } + } +} + impl PartialEq for Bool { fn eq(&self, rhs: &Obj) -> bool { match rhs {