pub enum Shape {
Text(Text),
Template(LineTemplate),
Pattern(Regex),
}Expand description
A unit’s shape.
Variants§
Text(Text)
text: what the text must equal, or the frontmatter key whose value
it must equal.
Template(LineTemplate)
template: the text written with typed holes.
Pattern(Regex)
pattern: a regex the text must match somewhere.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn regex(&self) -> Option<&Regex>
pub fn regex(&self) -> Option<&Regex>
The shape’s regex, whose named groups are the keys it can capture;
none for text.
Sourcepub fn matches(
&self,
text: &str,
value: impl Fn(&str) -> Option<String>,
) -> bool
pub fn matches( &self, text: &str, value: impl Fn(&str) -> Option<String>, ) -> bool
Whether text, squashed, has this shape. value resolves a
{ from: <key> } text to the frontmatter value, squashed.
Sourcepub fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>>
pub fn captures<'t>(&self, text: &'t str) -> Option<Captures<'t>>
The groups the shape captures from text.
Sourcepub fn failure(&self, text: &str) -> String
pub fn failure(&self, text: &str) -> String
Why text does not have this shape, as a finding continues a
sentence that opens with the text: does not match … or fails at column …. text names the shape of a literal.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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