Struct treefmt::eval_cache::CacheManifest
source · pub struct CacheManifest {
pub formatters: BTreeMap<FormatterName, FormatterInfo>,
pub matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>,
}
Expand description
RootManifest
Fields§
§formatters: BTreeMap<FormatterName, FormatterInfo>
Map of all the formatter infos
matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>
Map of all the formatted paths
Implementations§
source§impl CacheManifest
impl CacheManifest
sourcepub fn try_load(cache_dir: &Path, treefmt_toml: &Path) -> Result<Self>
pub fn try_load(cache_dir: &Path, treefmt_toml: &Path) -> Result<Self>
Loads the manifest and returns an error if it failed
sourcepub fn load(cache_dir: &Path, treefmt_toml: &Path) -> Self
pub fn load(cache_dir: &Path, treefmt_toml: &Path) -> Self
Always loads the manifest. If an error occurred, log and return an empty manifest.
sourcepub fn try_write(self, cache_dir: &Path, treefmt_toml: &Path) -> Result<()>
pub fn try_write(self, cache_dir: &Path, treefmt_toml: &Path) -> Result<()>
Serializes back the manifest into place.
sourcepub fn write(self, cache_dir: &Path, treefmt_toml: &Path)
pub fn write(self, cache_dir: &Path, treefmt_toml: &Path)
Serializes back the manifest into place.
sourcepub fn update_formatters(
&mut self,
formatters: BTreeMap<FormatterName, Formatter>
)
pub fn update_formatters( &mut self, formatters: BTreeMap<FormatterName, Formatter> )
Checks and inserts the formatter info into the cache. If the formatter info has changed, invalidate all the old paths.
sourcepub fn filter_matches(
&self,
matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>
) -> BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>
pub fn filter_matches( &self, matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>> ) -> BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>
Returns a new map with all the paths that haven’t changed
sourcepub fn add_results(
&mut self,
matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>>
)
pub fn add_results( &mut self, matches: BTreeMap<FormatterName, BTreeMap<PathBuf, FileMeta>> )
Merge recursively the new matches with the existing entries in the cache
Trait Implementations§
source§impl Clone for CacheManifest
impl Clone for CacheManifest
source§impl Debug for CacheManifest
impl Debug for CacheManifest
source§impl Default for CacheManifest
impl Default for CacheManifest
source§fn default() -> CacheManifest
fn default() -> CacheManifest
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for CacheManifest
impl<'de> Deserialize<'de> for CacheManifest
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
Auto Trait Implementations§
impl RefUnwindSafe for CacheManifest
impl Send for CacheManifest
impl Sync for CacheManifest
impl Unpin for CacheManifest
impl UnwindSafe for CacheManifest
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