Skip to content

Commit 152ea4a

Browse files
author
toasteater
committed
Implement ToVariant for bool.
1 parent 26c7bea commit 152ea4a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gdnative-core/src/variant.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,16 @@ impl ToVariant for String {
846846
}
847847
}
848848

849+
impl ToVariant for bool {
850+
fn to_variant(&self) -> Variant {
851+
Variant::from_bool(*self)
852+
}
853+
854+
fn from_variant(variant: &Variant) -> Option<Self> {
855+
variant.try_to_bool()
856+
}
857+
}
858+
849859
impl ToVariant for Variant {
850860
fn to_variant(&self) -> Variant {
851861
self.clone()

0 commit comments

Comments
 (0)