ParseError variantv0.1.0

Source
Why text could not be read as a value.
pub variant ParseError {
    Empty,
    InvalidCharacter(uint),
    Overflow(uint),
    OutOfMemory(uint)
}

Failure-only: every case is a failure, and each says where in the text it was found. Success is the other channel of the T ! ParseError a parser returns rather than a case here. Copy, carrying one offset.

Cases

NameDescription
EmptyThere were no bytes to read. The offset is zero, which is both the start of the text and its length.
InvalidCharacter(uint)A byte that is not part of the grammar, or a well-formed value with something after it. The offset is that byte, which is the text's length when the value stopped short.
Overflow(uint)The value is well formed and does not fit the width asked for. The offset is the digit that passed the widest representable magnitude, or the end of the number when the number itself is what does not fit.
OutOfMemory(uint)The exact arithmetic a wide float needs could not get the storage for it. This is the machine rather than the text: the same input on a less busy machine reads fine, which is what tells it apart from Overflow. The offset is where the parser had reached, which is the end of the number.

Implements ParseFailure

ParseError conforms to ParseFailure.

Offset

pub func Offset(self: &ParseError) -> uint

Where in the input the failure was found. Borrows the error and leaves it untouched. Cannot fail; runs in constant time and allocates nothing.

Returns: the zero-based UTF-8 byte offset, which is the text's length at end of input

Source