Skip to main content

Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn list(&self, page: &str) -> Result<Vec<Listed>>;
    fn create(
        &self,
        page: &str,
        anchor: Anchor,
        author: &str,
        text: &str,
    ) -> Result<String>;
    fn reply(
        &self,
        page: &str,
        id: &str,
        author: &str,
        text: &str,
    ) -> Result<()>;
    fn resolve(&self, page: &str, id: &str) -> Result<()>;
}
Expand description

The comment store port: where one served folder’s threads are kept. A page is the address of the Markdown file a thread is about (/a.md); one that climbs out of the served folder, and an id that isn’t a thread’s, are errors. Writes are silent — announcing them is Comments’s job.

Required Methods§

Source

fn list(&self, page: &str) -> Result<Vec<Listed>>

A page’s threads, oldest first.

Source

fn create( &self, page: &str, anchor: Anchor, author: &str, text: &str, ) -> Result<String>

Starts a thread on page; answers its id.

Source

fn reply(&self, page: &str, id: &str, author: &str, text: &str) -> Result<()>

Appends a reply to thread id.

Source

fn resolve(&self, page: &str, id: &str) -> Result<()>

Resolves thread id: it is gone.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§