pub enum WriteError {
InvalidHeadingLevel(u8),
NewlineInInlineElement(String),
FmtError(String),
UnsupportedNodeType,
InvalidStructure(String),
InvalidHtmlTag(String),
InvalidHtmlAttribute(String),
Custom {
message: String,
code: Option<String>,
},
}Expand description
Errors that can occur during CommonMark writing.
Variants§
InvalidHeadingLevel(u8)
An invalid heading level was encountered (must be 1-6).
NewlineInInlineElement(String)
A newline character was found in an inline element where it’s not allowed (e.g., in strict mode or specific contexts like table cells, link text, image alt text).
FmtError(String)
An underlying formatting error occurred.
UnsupportedNodeType
An unsupported node type was encountered.
InvalidStructure(String)
Invalid structure in a node (e.g., mismatched table columns)
InvalidHtmlTag(String)
An invalid HTML tag was found (contains unsafe characters)
InvalidHtmlAttribute(String)
An invalid HTML attribute was found (contains unsafe characters)
Custom
A custom error with a message and optional error code.
Implementations§
Source§impl WriteError
Convenience methods for creating custom errors
impl WriteError
Convenience methods for creating custom errors
Trait Implementations§
Source§impl Clone for WriteError
impl Clone for WriteError
Source§fn clone(&self) -> WriteError
fn clone(&self) -> WriteError
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WriteError
impl Debug for WriteError
Source§impl Display for WriteError
impl Display for WriteError
Source§impl Error for WriteError
impl Error for WriteError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for WriteError
impl From<Error> for WriteError
Source§impl PartialEq for WriteError
impl PartialEq for WriteError
impl Eq for WriteError
impl StructuralPartialEq for WriteError
Auto Trait Implementations§
impl Freeze for WriteError
impl RefUnwindSafe for WriteError
impl Send for WriteError
impl Sync for WriteError
impl Unpin for WriteError
impl UnwindSafe for WriteError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more