Search results

There are no results.

std.json.ErrorKind

class pub enum ErrorKind

A type describing the different possible errors.

End users don't really care about the difference between RecursionLimitExceeded and InvalidSurrogate(...), nor can they really act differently based on the kind of error.

Constructors

RecursionLimitExceeded

RecursionLimitExceeded(Int)

The maximum recursion limit is exceeded.

InvalidSurrogate

InvalidSurrogate(String)

An invalid UTF-16 surrogate pair is encountered.

Generic

Generic(String)

A generic error with a custom message.

Read

Read(Error)

An error occurred while reading from the input stream.

Instance methods

!=

Show source code
Hide 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 code
Hide source code
fn pub ==(other: ref ErrorKind) -> Bool {
  match (self, other) {
    case (RecursionLimitExceeded(a), RecursionLimitExceeded(b)) -> a == b
    case (InvalidSurrogate(a), InvalidSurrogate(b)) -> a == b
    case (Read(a), Read(b)) -> a == b
    case (Generic(a), Generic(b)) -> a == b
    case _ -> false
  }
}
fn pub ==(other: ref ErrorKind) -> 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 code
Hide source code
fn pub fmt(formatter: mut Formatter) {
  match self {
    case RecursionLimitExceeded(v) -> {
      formatter.tuple('RecursionLimitExceeded').field(v).finish
    }
    case InvalidSurrogate(v) -> {
      formatter.tuple('InvalidSurrogate').field(v).finish
    }
    case Read(v) -> formatter.tuple('Read').field(v).finish
    case Generic(v) -> formatter.tuple('Generic').field(v).finish
  }
}
fn pub fmt(formatter: mut Formatter)

Formats self in a human-readable format for debugging purposes.

to_string

Show source code
Hide source code
fn pub to_string -> String {
  match self {
    case RecursionLimitExceeded(v) -> {
      'the maximum recursion depth of ${v} is exceeded'
    }
    case InvalidSurrogate(v) -> "${v} isn't a valid UTF-16 surrogate pair"
    case Read(v) -> v.to_string
    case Generic(v) -> v.to_string
  }
}
fn pub to_string -> String

Converts self to a String.

Implemented traits

std.cmp.

Equal

impl Equal[ref ErrorKind] for ErrorKind
std.fmt.

Format

impl Format for ErrorKind
std.string.

ToString

impl ToString for ErrorKind