trait
Boolable
The Boolable
trait describes a type that can be converted to a bool.
This trait requires the type to implement the __bool__()
method. For
example:
@value
struct Foo(Boolable):
var val: Bool
fn __bool__(self) -> Bool:
return self.val
Implemented traits
AnyType
Methods
__bool__
__bool__(self: T) -> Bool
Get the boolean representation of the value.
Returns:
The boolean representation of the value.