Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }
Expand description

A handle to a .wipe board rooted at a project directory.

Implementations§

Source§

impl Store

Source

pub fn root(&self) -> &Path

The project root directory (the parent of .wipe).

Source

pub fn wipe_dir(&self) -> PathBuf

Path to the .wipe directory.

Source

pub fn media_dir(&self) -> PathBuf

Path to the media directory (version-controlled attachments).

Source

pub fn cache_dir(&self) -> PathBuf

Path to the (gitignored) cache directory.

Source

pub fn open(root: impl AsRef<Path>) -> Result<Self>

Open an existing board rooted exactly at root (which must contain .wipe).

Source

pub fn discover(start: impl AsRef<Path>) -> Result<Self>

Discover the board by walking up from start until a .wipe directory is found, mirroring how git locates its repository root.

Source

pub fn init( root: impl AsRef<Path>, name: &str, now: DateTime<Utc>, ) -> Result<Self>

Initialize a brand-new board under root with the default (standard) starter content. Fails with Error::AlreadyInitialized if a .wipe directory already exists.

Source

pub fn init_with( root: impl AsRef<Path>, name: &str, now: DateTime<Utc>, starter: Starter, ) -> Result<Self>

Initialize a brand-new board, choosing how much starter content to seed: standard lists+labels, lists only, or a blank board.

Source

pub fn load_board(&self) -> Result<Board>

Load board.json.

Source

pub fn save_board(&self, board: &Board) -> Result<()>

Write board.json deterministically and atomically.

Source

pub fn load_definitions(&self) -> Result<Definitions>

Load definitions.json.

Source

pub fn save_definitions(&self, defs: &Definitions) -> Result<()>

Write definitions.json.

Source

pub fn load_settings(&self) -> Result<Settings>

Load settings.json.

Source

pub fn save_settings(&self, settings: &Settings) -> Result<()>

Write settings.json.

Source

pub fn load_identities(&self) -> Result<Vec<Identity>>

Load identities.json (empty if the file doesn’t exist yet).

Source

pub fn save_identities(&self, identities: &[Identity]) -> Result<()>

Write identities.json.

Source

pub fn load_ticket(&self, id: &str) -> Result<Ticket>

Load a single ticket by ID.

Source

pub fn save_ticket(&self, ticket: &Ticket) -> Result<()>

Write a ticket file.

Source

pub fn delete_ticket(&self, id: &str) -> Result<()>

Delete a ticket file. Errors if it does not exist.

Source

pub fn ticket_ids(&self) -> Result<Vec<String>>

Return all ticket IDs currently on disk, sorted numerically by counter.

Source

pub fn load_all_tickets(&self) -> Result<Vec<Ticket>>

Load every ticket on disk, ordered by ID counter.

Source

pub fn forum_dir(&self) -> PathBuf

Path to the forum directory (.wipe/forum).

Source

pub fn thread_exists(&self, thread_id: &str) -> bool

Whether a thread file already exists on disk for thread_id.

Source

pub fn load_thread(&self, thread_id: &str) -> Result<Thread>

Load a forum thread by its thread ID (e.g. F-1).

Source

pub fn save_thread(&self, thread: &Thread) -> Result<()>

Write a forum thread file.

Source

pub fn delete_thread(&self, thread_id: &str) -> Result<()>

Delete a forum thread file. Errors if it does not exist.

Source

pub fn thread_ids(&self) -> Result<Vec<String>>

All forum thread IDs on disk, sorted numerically by counter.

Source

pub fn load_all_threads(&self) -> Result<Vec<Thread>>

Load every forum thread on disk, ordered by ID counter.

Trait Implementations§

Source§

impl Clone for Store

Source§

fn clone(&self) -> Store

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 Debug for Store

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.