pub struct Store<'w> { /* private fields */ }Expand description
File store for one project.
Implementations§
Source§impl<'w> Store<'w>
impl<'w> Store<'w>
pub fn new(project: &'w Project) -> Self
pub fn project(&self) -> &Project
Sourcepub fn path_for(&self, r: &ResourceRef) -> PathBuf
pub fn path_for(&self, r: &ResourceRef) -> PathBuf
Absolute path for a resource file.
Sourcepub fn list(&self) -> Result<Vec<(ResourceRef, PathBuf)>, StoreError>
pub fn list(&self) -> Result<Vec<(ResourceRef, PathBuf)>, StoreError>
Scan the project directory for resource files.
Sourcepub fn read(&self, r: &ResourceRef) -> Result<Value, StoreError>
pub fn read(&self, r: &ResourceRef) -> Result<Value, StoreError>
Read a resource file with sidecars inlined.
Sourcepub fn read_path(&self, path: &Path) -> Result<Value, StoreError>
pub fn read_path(&self, path: &Path) -> Result<Value, StoreError>
Read any resource file (must belong to this project) with sidecars inlined.
Sourcepub fn write(&self, r: &ResourceRef, value: &Value) -> Result<bool, StoreError>
pub fn write(&self, r: &ResourceRef, value: &Value) -> Result<bool, StoreError>
Write a resource: normalize for disk, extract sidecars, write only if the semantic content changed. Returns true if the file was (re)written.
Sourcepub fn delete(&self, r: &ResourceRef) -> Result<(), StoreError>
pub fn delete(&self, r: &ResourceRef) -> Result<(), StoreError>
Delete a resource file (and its default sidecars).
Auto Trait Implementations§
impl<'w> Freeze for Store<'w>
impl<'w> RefUnwindSafe for Store<'w>
impl<'w> Send for Store<'w>
impl<'w> Sync for Store<'w>
impl<'w> Unpin for Store<'w>
impl<'w> UnsafeUnpin for Store<'w>
impl<'w> UnwindSafe for Store<'w>
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