Skip to main content

Vault

Struct Vault 

Source
pub struct Vault {
    pub config: VaultConfig,
    pub date_handler: DateTimeHandler,
}

Fields§

§config: VaultConfig§date_handler: DateTimeHandler

Implementations§

Source§

impl Vault

Source

pub fn new(config: VaultConfig) -> Self

Source

pub fn get_table_headers(&self) -> (String, String)

Get locale-dependent table headers

Source

pub fn get_note_path(&self, date: NaiveDate) -> PathBuf

Source

pub fn add_note( &self, content: &str, timestamp: Option<DateTime<Local>>, ) -> Result<(), JourneyError>

Backwards-compatible API: add a note without category

Source

pub fn add_note_with_category( &self, content: &str, timestamp: Option<DateTime<Local>>, category: Option<&str>, ) -> Result<(), JourneyError>

Category-aware API used by the application

Source

pub fn find_section(&self, content: &str, section_name: &str) -> Option<usize>

Source

pub fn find_section_end(&self, lines: &[&str], section_start: usize) -> usize

Source

pub fn find_section_content_end( &self, lines: &[&str], section_start: usize, ) -> usize

Source

pub fn list_notes(&self, date: NaiveDate) -> Result<Vec<String>, JourneyError>

Backwards-compatible API: list notes without category

Source

pub fn list_notes_with_category( &self, date: NaiveDate, category: Option<&str>, ) -> Result<Vec<String>, JourneyError>

Category-aware API used by the application

Source

pub fn get_editor_path(&self, date: NaiveDate) -> PathBuf

Source

pub fn detect_note_format(&self, content: &str) -> Option<NoteFormat>

Detect the current note format in the content

Auto Trait Implementations§

§

impl Freeze for Vault

§

impl RefUnwindSafe for Vault

§

impl Send for Vault

§

impl Sync for Vault

§

impl Unpin for Vault

§

impl UnsafeUnpin for Vault

§

impl UnwindSafe for Vault

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> 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, 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.