Enum tor_netdoc::Error[][src]

#[non_exhaustive]
pub enum Error {
Show 32 variants Internal(Pos), MissingKeyword(Pos), TruncatedLine(Pos), BadKeyword(Pos), BadObjectBeginTag(Pos), BadObjectEndTag(Pos), BadObjectMismatchedTag(Pos), BadObjectBase64(Pos), DuplicateToken(&'static strPos), UnexpectedToken(&'static strPos), MissingToken(&'static str), MisplacedToken(&'static strPos), TooManyArguments(&'static strPos), TooFewArguments(&'static strPos), UnexpectedObject(&'static strPos), MissingObject(&'static strPos), WrongObject(Pos), MissingArgument(Pos), BadArgument(PosString), BadObjectVal(PosString), BadSignature(Pos), BadTorVersion(Pos), BadPolicy(PosPolicyError), Untimely(PosTimeValidityError), Undecodable(PosError), BadDocumentVersion(u32), BadDocumentType, WrongStartingToken(StringPos), WrongEndingToken(StringPos), WrongSortOrder(Pos), InvalidLifetime, CannotBuild(&'static str),
}
Expand description

An error that occurred while parsing a directory object of some kind.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Internal(Pos)

An internal error in the parser: these should never happen.

Tuple Fields of Internal

0: Pos
MissingKeyword(Pos)

An entry was found with no keyword.

Tuple Fields of MissingKeyword

0: Pos
TruncatedLine(Pos)

An entry was found with no newline at the end.

Tuple Fields of TruncatedLine

0: Pos
BadKeyword(Pos)

A bad string was found in the keyword position.

Tuple Fields of BadKeyword

0: Pos
BadObjectBeginTag(Pos)

We found an ill-formed “BEGIN FOO” tag.

Tuple Fields of BadObjectBeginTag

0: Pos
BadObjectEndTag(Pos)

We found an ill-formed “END FOO” tag.

Tuple Fields of BadObjectEndTag

0: Pos
BadObjectMismatchedTag(Pos)

We found a “BEGIN FOO” tag with an “END FOO” tag that didn’t match.

Tuple Fields of BadObjectMismatchedTag

0: Pos
BadObjectBase64(Pos)

We found a base64 object with an invalid base64 encoding.

Tuple Fields of BadObjectBase64

0: Pos
DuplicateToken(&'static strPos)

The document is not supposed to contain more than one of some kind of entry, but we found one anyway.

Tuple Fields of DuplicateToken

0: &'static str1: Pos
UnexpectedToken(&'static strPos)

The document is not supposed to contain any of some particular kind of entry, but we found one anyway.

Tuple Fields of UnexpectedToken

0: &'static str1: Pos
MissingToken(&'static str)

The document is supposed to contain any of some particular kind of entry, but we didn’t find one one anyway.

Tuple Fields of MissingToken

0: &'static str
MisplacedToken(&'static strPos)

The document was supposed to have one of these, but not where we found it.

Tuple Fields of MisplacedToken

0: &'static str1: Pos
TooManyArguments(&'static strPos)

We found more arguments on an entry than it is allowed to have.

Tuple Fields of TooManyArguments

0: &'static str1: Pos
TooFewArguments(&'static strPos)

We didn’t fine enough arguments for some entry.

Tuple Fields of TooFewArguments

0: &'static str1: Pos
UnexpectedObject(&'static strPos)

We found an object attached to an entry that isn’t supposed to have one.

Tuple Fields of UnexpectedObject

0: &'static str1: Pos
MissingObject(&'static strPos)

An entry was supposed to have an object, but it didn’t.

Tuple Fields of MissingObject

0: &'static str1: Pos
WrongObject(Pos)

We found an object on an entry, but the type was wrong.

Tuple Fields of WrongObject

0: Pos
MissingArgument(Pos)

We tried to find an argument that we were sure would be there, but it wasn’t!

This error should never occur in correct code; it should be caught earlier by TooFewArguments.

Tuple Fields of MissingArgument

0: Pos
BadArgument(PosString)

We found an argument that couldn’t be parsed.

Tuple Fields of BadArgument

0: Pos1: String
BadObjectVal(PosString)

We found an object that couldn’t be parsed after it was decoded.

Tuple Fields of BadObjectVal

0: Pos1: String
BadSignature(Pos)

There was some signature that we couldn’t validate.

Tuple Fields of BadSignature

0: Pos
BadTorVersion(Pos)

There was a tor version we couldn’t parse.

Tuple Fields of BadTorVersion

0: Pos
BadPolicy(PosPolicyError)

There was an ipv4 or ipv6 policy entry that we couldn’t parse.

Tuple Fields of BadPolicy

0: Pos1: PolicyError

An object was expired or not yet valid.

Tuple Fields of Untimely

0: Pos1: TimeValidityError
Undecodable(PosError)

An underlying byte sequence couldn’t be decoded.

Tuple Fields of Undecodable

0: Pos1: Error
BadDocumentVersion(u32)

Versioned document with an unrecognized version.

Tuple Fields of BadDocumentVersion

0: u32
BadDocumentType

Unexpected document type

WrongStartingToken(StringPos)

Document or section started with wrong token

Tuple Fields of WrongStartingToken

0: String1: Pos
WrongEndingToken(StringPos)

Document or section ended with wrong token

Tuple Fields of WrongEndingToken

0: String1: Pos
WrongSortOrder(Pos)

Items not sorted as expected

Tuple Fields of WrongSortOrder

0: Pos
InvalidLifetime

A consensus lifetime was ill-formed.

CannotBuild(&'static str)

We’re unable to finish building an object, for some reason.

Tuple Fields of CannotBuild

0: &'static str

Implementations

Return a new error based on this one, with any byte-based position mapped to some line within a string.

Return a new error based on this one, with the position (if any) replaced by ‘p’.

Return a new error based on this one, with the position (if replaced by ‘p’ if it had no position before.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.