pub struct Metadata { /* private fields */ }
Expand description
The metadata for all files we’re tracking.
The implementations of agde need to provide methods to create and save this.
You can call Clone::clone_from
for an optimized cloning method.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn new(map: HashMap<String, ResourceMeta>) -> Self
pub fn new(map: HashMap<String, ResourceMeta>) -> Self
Create a new metadata map.
sourcepub fn iter(&self) -> impl Iterator<Item = (&str, ResourceMeta)>
pub fn iter(&self) -> impl Iterator<Item = (&str, ResourceMeta)>
Get an iterator over all the resources and their respective metadata.
sourcepub fn get(&self, resource: &str) -> Option<ResourceMeta>
pub fn get(&self, resource: &str) -> Option<ResourceMeta>
Get the metadata for resource
.
sourcepub fn insert(&mut self, resource: String, meta: ResourceMeta)
pub fn insert(&mut self, resource: String, meta: ResourceMeta)
Insert the meta
for resource
.
sourcepub fn changes(
&self,
target: &Self,
ignore_mtime_of_last_event: bool,
) -> Vec<MetadataChange>
pub fn changes( &self, target: &Self, ignore_mtime_of_last_event: bool, ) -> Vec<MetadataChange>
Calculate the changes to get the metadata from self
to target
.
ignore_mtime_of_last_event
is used when diffing locally, as we don’t care about the
unrelated mtime_of_last_event
in the current storage.
sourcepub fn apply_changes(&mut self, changes: &[MetadataChange], target: &Self)
pub fn apply_changes(&mut self, changes: &[MetadataChange], target: &Self)
Apply the changes gathered from Self::changes
to self
, while fetching data from
target
.
This means you can apply the changes between two metadata sets on a third set.
Also see Self::apply_current_mtime_changes
sourcepub fn apply_current_mtime_changes(&mut self, changes: &[MetadataChange])
pub fn apply_current_mtime_changes(&mut self, changes: &[MetadataChange])
Same as Self::apply_changes
but also
apply the ResourceMeta::mtime_in_current
to get self
to target
.
This is here to update the mtime of resources which did not get their mtime updated due to the diff being empty.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
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>,
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)