pub struct FileDep {
pub path: XvcPath,
pub xvc_metadata: Option<XvcMetadata>,
pub content_digest: Option<ContentDigest>,
}
Expand description
A file dependency for a pipeline step. It keeps track of path, metadata and the digest of the file.
Fields§
§path: XvcPath
The path in the workspace
xvc_metadata: Option<XvcMetadata>
XvcMetadata of the file if it’s available
content_digest: Option<ContentDigest>
ContentDigest of the file if it’s available
Implementations§
Source§impl FileDep
impl FileDep
Sourcepub fn new(path: XvcPath) -> Self
pub fn new(path: XvcPath) -> Self
Create a new file dependency with metadata and digest set to None.
Sourcepub fn from_pmp(path: &XvcPath, pmp: &XvcPathMetadataProvider) -> Result<Self>
pub fn from_pmp(path: &XvcPath, pmp: &XvcPathMetadataProvider) -> Result<Self>
Create a file dependency with the given path and metadata obtained from [XvcPathMetadataMap]
Sourcepub fn calculate_content_digest(
self,
xvc_root: &XvcRoot,
algorithm: HashAlgorithm,
text_or_binary: TextOrBinary,
) -> Result<Self>
pub fn calculate_content_digest( self, xvc_root: &XvcRoot, algorithm: HashAlgorithm, text_or_binary: TextOrBinary, ) -> Result<Self>
Returns a new instance with the updated content digest
Sourcepub fn calculate_content_digest_if_changed(
self,
xvc_root: &XvcRoot,
record: &Self,
algorithm: HashAlgorithm,
text_or_binary: TextOrBinary,
) -> Result<Self>
pub fn calculate_content_digest_if_changed( self, xvc_root: &XvcRoot, record: &Self, algorithm: HashAlgorithm, text_or_binary: TextOrBinary, ) -> Result<Self>
Returns a new instance with a new content digest if the metadata has changed
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileDep
impl<'de> Deserialize<'de> for FileDep
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
Source§impl Diffable for FileDep
impl Diffable for FileDep
Source§fn diff_thorough(record: &Self::Item, actual: &Self::Item) -> Diff<Self::Item>
fn diff_thorough(record: &Self::Item, actual: &Self::Item) -> Diff<Self::Item>
⚠️ Call actual.update_metadata and actual.calculate_content_digest_if_changed before calling this ⚠️
Source§fn diff_superficial(
record: &Self::Item,
actual: &Self::Item,
) -> Diff<Self::Item>
fn diff_superficial( record: &Self::Item, actual: &Self::Item, ) -> Diff<Self::Item>
This is to compare two entities with a quick comparison.
Example: metadata of a file, timestamp of a URL etc.
You may need to update actual’s metadata or timestamp before calling this.
Source§fn diff(
record: Option<&Self::Item>,
actual: Option<&Self::Item>,
) -> Diff<Self::Item>
fn diff( record: Option<&Self::Item>, actual: Option<&Self::Item>, ) -> Diff<Self::Item>
⚠️ Usually you must update actual’s metadata and timestamp before calling this.
Use diff_superficial and diff_thorough for shortcut comparisons. (e.g. when metadata is not changed, no need to
compare the content. ) Read more
Source§impl From<FileDep> for XvcDependency
impl From<FileDep> for XvcDependency
Source§impl Ord for FileDep
impl Ord for FileDep
Source§impl PartialOrd for FileDep
impl PartialOrd for FileDep
Source§impl Storable for FileDep
impl Storable for FileDep
Source§fn type_description() -> String
fn type_description() -> String
A string representation for the type. Read more
impl Eq for FileDep
impl StructuralPartialEq for FileDep
Auto Trait Implementations§
impl Freeze for FileDep
impl RefUnwindSafe for FileDep
impl Send for FileDep
impl Sync for FileDep
impl Unpin for FileDep
impl UnwindSafe for FileDep
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more