std.json.Type
class pub enum Type
A type describing what kind of value is located at the current position in an input stream.
Constructors
Array
Array()
Bool
Bool()
Null
Null()
Number
Number()
Object
Object()
String
String()
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref Type) -> Bool {
match (self, other) {
case (Array, Array) -> true
case (Bool, Bool) -> true
case (Null, Null) -> true
case (Number, Number) -> true
case (Object, Object) -> true
case (String, String) -> true
case _ -> false
}
}
fn pub ==(other: ref Type) -> Bool
Returns true
if self
and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
let name = match self {
case Array -> 'Array'
case Bool -> 'Bool'
case Null -> 'Null'
case Number -> 'Number'
case Object -> 'Object'
case String -> 'String'
}
formatter.tuple(name).finish
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
Implemented traits
Equal
impl Equal[ref Type] for Type
Format
impl Format for Type