pub struct FileSettingsStorage { /* private fields */ }Expand description
File-backed storage: {agentDir}/settings.json and {cwd}/.pi/settings.json.
Mirrors TypeScript FileSettingsStorage:
- the settings file itself is locked (
settings.json.locksibling) - a missing file is read without acquiring the lock when no write happens
- the parent directory is created only when content is actually written
Implementations§
Source§impl FileSettingsStorage
impl FileSettingsStorage
Sourcepub fn new(cwd: impl AsRef<Path>, agent_dir: impl AsRef<Path>) -> Self
pub fn new(cwd: impl AsRef<Path>, agent_dir: impl AsRef<Path>) -> Self
Create storage rooted at cwd (project) and agent_dir (global).
Sourcepub fn global_settings_path(&self) -> &Path
pub fn global_settings_path(&self) -> &Path
Path of the global settings file.
Sourcepub fn project_settings_path(&self) -> &Path
pub fn project_settings_path(&self) -> &Path
Path of the project settings file.
Trait Implementations§
Source§impl Debug for FileSettingsStorage
impl Debug for FileSettingsStorage
Auto Trait Implementations§
impl Freeze for FileSettingsStorage
impl RefUnwindSafe for FileSettingsStorage
impl Send for FileSettingsStorage
impl Sync for FileSettingsStorage
impl Unpin for FileSettingsStorage
impl UnsafeUnpin for FileSettingsStorage
impl UnwindSafe for FileSettingsStorage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.