pub struct CycleStore { /* private fields */ }Expand description
A cycle store rooted at a project root (root/docs/cycles).
Implementations§
Source§impl CycleStore
impl CycleStore
Sourcepub fn new(root: &Path) -> Self
pub fn new(root: &Path) -> Self
Bind the store to root/docs/cycles; the directory is not created here.
Sourcepub fn exists(&self) -> bool
pub fn exists(&self) -> bool
Whether docs/cycles/ exists. Its absence means “read legacy
tix.toml” and is not an error.
Sourcepub fn list(&self) -> Result<Vec<CycleRecord>>
pub fn list(&self) -> Result<Vec<CycleRecord>>
Every stored cycle, sorted by filename, with the implicit Default
cycle always available. A missing directory yields just Default.
Sourcepub fn get(&self, name: &str) -> Result<CycleRecord>
pub fn get(&self, name: &str) -> Result<CycleRecord>
Look a cycle up by name. The implicit Default cycle is only returned
when it is a real file; callers that need the synthetic default use
CycleStore::list.
Sourcepub fn save(
&self,
name: &str,
cycle: &PlanningCycle,
body: Option<&str>,
) -> Result<()>
pub fn save( &self, name: &str, cycle: &PlanningCycle, body: Option<&str>, ) -> Result<()>
Write a cycle to docs/cycles/<slug(name)>.md, replacing any file of
that name and creating the directory on demand.
Identity survives the legacy path. This is the write a hand-written cycle
edit goes through, and it takes only a PlanningCycle, which has no notion of
a generated identity — so the record already on disk is read first and its
schedule_id/sequence/state are carried over. Without that, one tix cycle edit on a generated cycle would silently strip the stable identity its
snapshots and idempotency keys hang off.
A generated cycle is written through CycleStore::save_record, which takes
the whole record.
Sourcepub fn save_record(
&self,
record: &CycleRecord,
body: Option<&str>,
) -> Result<()>
pub fn save_record( &self, record: &CycleRecord, body: Option<&str>, ) -> Result<()>
Write a whole CycleRecord — the path a generated cycle takes, because it
is the only one that can carry the identity fields.
Trait Implementations§
Source§impl Clone for CycleStore
impl Clone for CycleStore
Source§impl Debug for CycleStore
impl Debug for CycleStore
impl Eq for CycleStore
Source§impl PartialEq for CycleStore
impl PartialEq for CycleStore
impl StructuralPartialEq for CycleStore
Auto Trait Implementations§
impl Freeze for CycleStore
impl RefUnwindSafe for CycleStore
impl Send for CycleStore
impl Sync for CycleStore
impl Unpin for CycleStore
impl UnsafeUnpin for CycleStore
impl UnwindSafe for CycleStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more