pub enum Error {
Parse(String),
Edit(String),
Residue {
found: String,
},
Malformed {
found: String,
},
}Expand description
Why a body could not be filtered.
Every variant means the caller must not publish the body it passed in. There is no “filtered as best we could” outcome on purpose: a partial filter is indistinguishable from a complete one by inspection, and the thing it silently keeps is the thing someone declared private.
Variants§
Parse(String)
The body could not be parsed, so no region in it could be located.
Edit(String)
An edit twig refused. Structural, not authorial — a bug here rather than in the document.
Residue
A marker survived the filter.
The backstop for the failure this module is most likely to have: a region spelled in a way this module does not recognize is a region nothing removed, and its content is then published to everyone. Cheap to check, and it converts the worst outcome (a silent leak) into the ordinary one (a refused publish naming the document).
Malformed
A region the parser could not read as one.
The signature of twig’s one structural gap here: it does not nest
inline directives, so the outer half of :vis[a :vis[b]{.x} c]{.y}
parses as a bare :vis carrying neither attributes nor an interior,
while a, c and the {.y} that scoped them stay outside it as prose.
Unwrapping that marker would delete the word :vis and publish
everything it was scoping — a leak with no marker left behind for
Residue to find, which is why it is caught here by
shape instead. Nested block regions are unaffected and work.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.