pub struct Document {
pub bom: String,
pub front: Option<Frontmatter>,
pub body: String,
pub eol: &'static str,
/* private fields */
}Expand description
A file split into its pieces; joining them gives the original bytes.
Fields§
§bom: StringA UTF-8 byte order mark, kept as is.
front: Option<Frontmatter>None when the file does not open with a frontmatter block.
body: StringEverything after the closing fence, untouched.
eol: &'static str"\r\n" when the file uses CRLF, else "\n".
Implementations§
Source§impl Document
impl Document
Sourcepub fn parse(text: &str) -> Document
pub fn parse(text: &str) -> Document
Splits text; never fails (a file without a block has front: None).
Sourcepub fn ensure_front(&mut self) -> &mut Frontmatter
pub fn ensure_front(&mut self) -> &mut Frontmatter
Makes sure there is a block to write into, with the file’s line ending.
Trait Implementations§
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Documentwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Segment>: Freeze,
&'static str: Freeze,
impl Move for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Documentwhere
RawVecInner: Sync,
impl Unpin for Document
impl UnsafeUnpin for Documentwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Segment>: UnsafeUnpin,
&'static str: UnsafeUnpin,
impl UnwindSafe for Document
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
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§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
Compare self to
key and return true if they are equal.