pub struct Profile<'a> {
pub narrative: Cow<'a, str>,
pub ignore_line_postfix: Cow<'a, str>,
pub ignored_block_start: Cow<'a, str>,
pub ignored_block_end: Cow<'a, str>,
pub indent: Cow<'a, str>,
}Expand description
A configuration for document extraction.
Fields§
§narrative: Cow<'a, str>Introduces a narrative comment.
ignore_line_postfix: Cow<'a, str>If a line of code ends with this, do not include it the output.
ignored_block_start: Cow<'a, str>Starts a block of lines, all of which will be ignored until ignored_block_end.
ignored_block_end: Cow<'a, str>Ends an ignored block.
indent: Cow<'a, str>Sets the additional indentation for all following code blocks.
Implementations§
Source§impl<'a> Profile<'a>
impl<'a> Profile<'a>
Sourcepub fn from_comment(comment: &str) -> Self
pub fn from_comment(comment: &str) -> Self
Create a profile from a line comment string.
For instance, if in your language’s line comments start with ~~~,
you can quickly create a standard profile for it like so:
let profile = Profile::from_comment("~~~");
assert_eq!(profile.narrative, "~~~:");
assert_eq!(profile.ignore_line_postfix, "~~~");
assert_eq!(profile.ignored_block_start, "~~~{");
assert_eq!(profile.ignored_block_end, "~~~}");
assert_eq!(profile.indent, "~~~>");If you need more customization, use the various with_* builder methods.
pub fn with_narrative(self, s: impl Into<Cow<'a, str>>) -> Self
pub fn with_ignore_line_postfix(self, s: impl Into<Cow<'a, str>>) -> Self
pub fn with_ignored_block_start(self, s: impl Into<Cow<'a, str>>) -> Self
pub fn with_ignored_block_end(self, s: impl Into<Cow<'a, str>>) -> Self
pub fn with_indent(self, s: impl Into<Cow<'a, str>>) -> Self
Trait Implementations§
impl<'a> Eq for Profile<'a>
impl<'a> StructuralPartialEq for Profile<'a>
Auto Trait Implementations§
impl<'a> Freeze for Profile<'a>
impl<'a> RefUnwindSafe for Profile<'a>
impl<'a> Send for Profile<'a>
impl<'a> Sync for Profile<'a>
impl<'a> Unpin for Profile<'a>
impl<'a> UnsafeUnpin for Profile<'a>
impl<'a> UnwindSafe for Profile<'a>
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