pub struct Index {
pub beans: Vec<IndexEntry>,
}Fields§
§beans: Vec<IndexEntry>Implementations§
Source§impl Index
impl Index
Sourcepub fn build(beans_dir: &Path) -> Result<Self>
pub fn build(beans_dir: &Path) -> Result<Self>
Build the index by reading all bean files from the beans directory. Supports both new format ({id}-{slug}.md) and legacy format ({id}.yaml). Excludes config.yaml, index.yaml, and bean.yaml. Sorts entries by ID using natural ordering. Returns an error if duplicate bean IDs are detected.
Sourcepub fn is_stale(beans_dir: &Path) -> Result<bool>
pub fn is_stale(beans_dir: &Path) -> Result<bool>
Check whether the cached index is stale. Returns true if the index file is missing or if any bean file (.md or .yaml) in the beans directory has been modified after the index was last written.
Sourcepub fn load_or_rebuild(beans_dir: &Path) -> Result<Self>
pub fn load_or_rebuild(beans_dir: &Path) -> Result<Self>
Load the cached index or rebuild it if stale. This is the main entry point for read-heavy commands.
Sourcepub fn collect_archived(beans_dir: &Path) -> Result<Vec<IndexEntry>>
pub fn collect_archived(beans_dir: &Path) -> Result<Vec<IndexEntry>>
Collect all archived beans from .beans/archive/ directory. Walks through year/month subdirectories and loads all bean files. Returns IndexEntry items for archived beans.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Index
impl<'de> Deserialize<'de> for Index
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more