pub struct PlanStore { /* private fields */ }Expand description
Stores and retrieves plan files for sessions.
Implementations§
Source§impl PlanStore
impl PlanStore
Sourcepub fn new(data_dir: impl AsRef<Path>) -> Result<Self, PlanStoreError>
pub fn new(data_dir: impl AsRef<Path>) -> Result<Self, PlanStoreError>
Create a new plan store with the given base data directory.
Plans are stored in {data_dir}/plans/.
Sourcepub fn plan_file_path(&self, session_id: &str) -> PathBuf
pub fn plan_file_path(&self, session_id: &str) -> PathBuf
Path to the plan file for a given session.
Sourcepub fn write_plan(
&self,
session_id: &str,
content: impl AsRef<str>,
) -> Result<PathBuf, PlanStoreError>
pub fn write_plan( &self, session_id: &str, content: impl AsRef<str>, ) -> Result<PathBuf, PlanStoreError>
Write a plan for the given session.
Overwrites any existing plan for this session.
Sourcepub fn read_plan(&self, session_id: &str) -> Option<String>
pub fn read_plan(&self, session_id: &str) -> Option<String>
Read the plan for the given session, if it exists.
Sourcepub fn plan_exists(&self, session_id: &str) -> bool
pub fn plan_exists(&self, session_id: &str) -> bool
Check whether a plan exists for the given session.
Sourcepub fn delete_plan(&self, session_id: &str) -> Result<(), PlanStoreError>
pub fn delete_plan(&self, session_id: &str) -> Result<(), PlanStoreError>
Delete the plan for the given session.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PlanStore
impl RefUnwindSafe for PlanStore
impl Send for PlanStore
impl Sync for PlanStore
impl Unpin for PlanStore
impl UnsafeUnpin for PlanStore
impl UnwindSafe for PlanStore
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