Skip to main content

value_to_bool

Function value_to_bool 

Source
pub fn value_to_bool(value: &Value) -> bool
Expand description

Convert a Value to its boolean representation.

  • Bool(b)b
  • Int(0)false, other ints → true
  • String("")false, non-empty → true
  • Nullfalse
  • Float(0.0)false, other floats → true
  • Json(null)false, Json([])false, Json({})false, others → true
  • Blob(_)true (blobs always exist if referenced)