[][src]Struct tp_note::note::Note

pub struct Note {
    front_matter: Option<FrontMatter>,
    context: ContextWrapper,
    pub content: Content,

Represents a note.


front_matter: Option<FrontMatter>

The front matter of the note.

context: ContextWrapper

Captured environment of tp-note that is used to fill in templates.

content: Content

The full text content of the note, including its front matter.


impl Note[src]

pub fn from_existing_note(path: &Path) -> Result<Self>[src]

Constructor that creates a memory representation of an existing note on disk.

pub fn new(path: &Path, template: &str) -> Result<Self>[src]

Constructor that creates a new note by filling in the template template.

fn capture_environment(path: &Path) -> Result<ContextWrapper>[src]

Capture tp_note's environment and stores it as variables in a context collection. The variables are needed later to populate a context-template and a filename-template. The path parameter must be a canonicalized fully qualified file name.

pub fn render_filename(&self, template: &str) -> Result<PathBuf>[src]

Applies a Tera-template to the notes context in order to generate a sanitized filename that is in sync with the note's meta data stored in its front matter.

fn shorten_filename(fqfn: &Path) -> PathBuf[src]

Shortens the stem of a filename so that file_stem.len()+file_extension.len() <= NOTE_FILENAME_LEN_MAX

fn deserialize_note(content: &str) -> Result<FrontMatter>[src]

Helper function deserializing the front-matter of an .md-file.

pub fn write_to_disk(&self, new_fqfn: &Path) -> Result<PathBuf, Error>[src]

Writes the note to disk with new_fqfn-filename.

Trait Implementations

impl Debug for Note[src]

impl PartialEq<Note> for Note[src]

impl StructuralPartialEq for Note[src]

Auto Trait Implementations

impl RefUnwindSafe for Note

impl Send for Note

impl Sync for Note

impl Unpin for Note

impl UnwindSafe for Note

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> Sealed<T> for T where
    T: ?Sized

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,