[−][src]Struct extract_frontmatter::Extractor
Extracts front-matter depending on how it is configured.
Once instantiated, call one of the available select_by_*() methods, optionally call any of the other modifier methods, and then finally call extract() to get a copy of the front-matter.
Calling multiple select_by_*() methods will result in only the latest call taking effect.
Each modifier can only be set once and are applied in a specific order (though setting them can be done in any order):
discard_first_linediscard_last_linestrip_prefixstrip_whitespace
Attempting to set the same modifier multiple times will result in only one call taking effect (with which one being arbitrary).
Implementations
impl<'a, 'b, 'c> Extractor<'a, 'b, 'c>[src]
pub fn new(input: &'a str) -> Self[src]
Instantiates a new front-matter Extractor for the given &str
pub fn extract(&self) -> String[src]
Using the configured selectors and modifiers, return a copy of input's front-matter as a String
pub fn collect(&self) -> Vec<&str>[src]
Using the configured selectors and modifiers, collect lines of front-matter into a Vec<&str>
pub fn select_by_terminator(&mut self, terminator: &'b str) -> &mut Self[src]
Updates the selector used by the Extractor to select lines until the first equal to terminator is found
pub fn select_by_prefix(&mut self, prefix: &'b str) -> &mut Self[src]
Updates the selector used by the Extractor to select consecutive lines starting with prefix
pub fn select_by_line_count(&mut self, count: usize) -> &mut Self[src]
Updates the selector used by the Extractor to select count lines
pub fn discard_first_line(&mut self) -> &mut Self[src]
Adds a modifier to discard the first line that would've been returned
pub fn discard_last_line(&mut self) -> &mut Self[src]
Adds a modifier to discard the last line that would've been returned
pub fn strip_prefix(&mut self, prefix: &'c str) -> &mut Self[src]
Adds a modifier to strip the the given prefix from all returned lines
pub fn strip_whitespace(&mut self) -> &mut Self[src]
Adds a modifier to strip leading and trailing whitespace from all returned lines
Trait Implementations
Auto Trait Implementations
impl<'a, 'b, 'c> RefUnwindSafe for Extractor<'a, 'b, 'c>
impl<'a, 'b, 'c> Send for Extractor<'a, 'b, 'c>
impl<'a, 'b, 'c> Sync for Extractor<'a, 'b, 'c>
impl<'a, 'b, 'c> Unpin for Extractor<'a, 'b, 'c>
impl<'a, 'b, 'c> UnwindSafe for Extractor<'a, 'b, 'c>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,