Skip to main content

Split

Struct Split 

Source
#[non_exhaustive]
pub struct Split<'a> { pub yaml: Option<&'a str>, pub yaml_range: Range<usize>, pub body: &'a str, pub body_start: usize, pub shape: NoteShape, pub unterminated: bool, }
Expand description

A note split into its parts, with byte offsets into the original source.

The fields are public to read, but the type is #[non_exhaustive]. You get one from split, never a struct literal, so a later field is not a breaking change.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§yaml: Option<&'a str>

The frontmatter YAML, verbatim and without the --- fences. None when the note has no frontmatter block at all.

§yaml_range: Range<usize>

Byte range of yaml within the source (empty when yaml is None).

§body: &'a str

Everything after the closing fence.

§body_start: usize

Byte offset of body within the source.

§shape: NoteShape

The framing to restore when writing this note back.

§unterminated: bool

true when the note opens a frontmatter block that never closes: it starts with a valid opening fence (--- and a line break, after an optional BOM) and no closing --- line follows. yaml is still None and body the whole text, as for a note with no block, so a reader of many notes keeps going. A caller that requires valid frontmatter can read this to report the note as malformed instead. false otherwise.

Trait Implementations§

Source§

impl<'a> Clone for Split<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Split<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for Split<'a>

Source§

impl<'a> PartialEq for Split<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for Split<'a>

Auto Trait Implementations§

§

impl<'a> Forget for Split<'a>

§

impl<'a> Freeze for Split<'a>

§

impl<'a> Move for Split<'a>

§

impl<'a> RefUnwindSafe for Split<'a>

§

impl<'a> Send for Split<'a>

§

impl<'a> Sync for Split<'a>

§

impl<'a> Unpin for Split<'a>

§

impl<'a> UnsafeUnpin for Split<'a>

§

impl<'a> UnwindSafe for Split<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.