pub enum HmlError<P>where
P: Posn,{
IoError {
span: Span<P>,
source: Error,
},
MarkupError {
span: Span<P>,
source: MarkupError,
},
ExpectedTagName {
span: Span<P>,
},
ExpectedWhitespaceAfterTag {
span: Span<P>,
},
UnexpectedCharacter {
span: Span<P>,
ch: char,
},
UnexpectedTagIndent {
span: Span<P>,
depth: usize,
},
BeyondEndOfTokens,
UnexpectedAttribute {
span: Span<P>,
attr: String,
},
UnexpectedNewlineInQuotedString {
span: Span<P>,
},
ExpectedEquals {
span: Span<P>,
ch: char,
},
UnexpectedEOF {
span: Span<P>,
},
}Expand description
HmlError represents an error from the UTF-8 character reader, either an IO error from the reader or a malformed UTF-8 encoded set of bytes.
Variants§
IoError
An IO error
MarkupError
A markup error
ExpectedTagName
Expected a tag name after hashes
ExpectedWhitespaceAfterTag
Expect whitespace after a tag
UnexpectedCharacter
An unexpected character
UnexpectedTagIndent
Expected a depth of N or N+1
BeyondEndOfTokens
Iterated beyond the end of the reader stream
UnexpectedAttribute
Attribute provided where an attribute was not expected
UnexpectedNewlineInQuotedString
Newline in a quoted string
ExpectedEquals
Expected an ‘=’ for an attribute but got something else
UnexpectedEOF
EOF when it was not expected
Implementations§
Source§impl<P> HmlError<P>where
P: Posn,
impl<P> HmlError<P>where
P: Posn,
Sourcepub fn unexpected_eof<T>(start: &P, end: &P) -> HmlResult<T, P>
pub fn unexpected_eof<T>(start: &P, end: &P) -> HmlResult<T, P>
Return an unexpected_eof error at the specified positions
Sourcepub fn unexpected_character<T>(start: &P, end: &P, ch: char) -> HmlResult<T, P>
pub fn unexpected_character<T>(start: &P, end: &P, ch: char) -> HmlResult<T, P>
Return an unexpected_character error at the specified positions
Sourcepub fn unexpected_newline_in_string<T>(start: &P, end: &P) -> HmlResult<T, P>
pub fn unexpected_newline_in_string<T>(start: &P, end: &P) -> HmlResult<T, P>
Return an unexpected newline error
Sourcepub fn expected_equals<T>(start: &P, end: &P, ch: char) -> HmlResult<T, P>
pub fn expected_equals<T>(start: &P, end: &P, ch: char) -> HmlResult<T, P>
Return an error indicating an expected character, but got a different character
Sourcepub fn no_more_events<T>() -> HmlResult<T, P>
pub fn no_more_events<T>() -> HmlResult<T, P>
Return an error indicating a read beyond the end of the stream
Sourcepub fn unexpected_tag_indent<T>(span: Span<P>, depth: usize) -> HmlResult<T, P>
pub fn unexpected_tag_indent<T>(span: Span<P>, depth: usize) -> HmlResult<T, P>
Return an unexpected_tag_indent error over the specified span
Source§impl<P> HmlError<P>where
P: Posn,
impl<P> HmlError<P>where
P: Posn,
Sourcepub fn map_markup_error<T>(
result: MarkupResult<T>,
span: &Span<P>,
) -> HmlResult<T, P>
pub fn map_markup_error<T>( result: MarkupResult<T>, span: &Span<P>, ) -> HmlResult<T, P>
Map a MarkupResult to an HmlResult; this passes an Ok value through unchanged, but it maps an Err to an HmlResult::MarkupError with the provided span
Trait Implementations§
Source§impl<P> Error for HmlError<P>
impl<P> Error for HmlError<P>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()