Skip to main content

SortableDoc

Trait SortableDoc 

Source
pub trait SortableDoc {
    // Required methods
    fn url_path(&self) -> &str;
    fn date(&self) -> Option<&str>;
    fn weight(&self) -> Option<i32>;
    fn declared_sort(&self) -> Option<&SortField>;
    fn clean_stem(&self) -> &str;

    // Provided method
    fn is_folder_index(&self) -> bool { ... }
}
Expand description

Minimal document trait for sort inference. Both src-tauri’s ParsedDocument and the editor’s in-memory document model implement this.

Required Methods§

Source

fn url_path(&self) -> &str

Source

fn date(&self) -> Option<&str>

Source

fn weight(&self) -> Option<i32>

Source

fn declared_sort(&self) -> Option<&SortField>

Source

fn clean_stem(&self) -> &str

Provided Methods§

Source

fn is_folder_index(&self) -> bool

Whether this doc is a folder-index page. moss uses pretty URLs (<stem>/index.html) for both articles and subfolder indexes, so the URL pattern alone can’t tell them apart. Implementors that distinguish via metadata (e.g. kind == Folder) should override. Default returns false — safe for callers that only ever pass articles in.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§