Skip to main content

ConfigOperations

Trait ConfigOperations 

Source
pub trait ConfigOperations {
    // Required methods
    fn with_config<P: AsRef<Path>>(self, config_path: P) -> Self;
    fn calculate_checksum<P: AsRef<Path>>(
        &self,
        path: P,
        algorithm: ChecksumAlgorithm,
    ) -> Result<ChecksumResult>;
    fn calculate_checksums<P: AsRef<Path>>(
        &self,
        path: P,
        algorithms: &[ChecksumAlgorithm],
    ) -> Result<Vec<ChecksumResult>>;
    fn verify_checksum<P: AsRef<Path>>(
        &self,
        path: P,
        expected: &str,
        algorithm: ChecksumAlgorithm,
    ) -> Result<bool>;
    fn diff<P: AsRef<Path>, Q: AsRef<Path>>(
        &self,
        source: P,
        target: Q,
    ) -> Result<DiffResult>;
    fn diff_tags<P: AsRef<Path>, Q: AsRef<Path>>(
        &self,
        source: P,
        target: Q,
        tags: &[TagId],
    ) -> Result<DiffResult>;
}
Expand description

配置操作 trait

Required Methods§

Source

fn with_config<P: AsRef<Path>>(self, config_path: P) -> Self

加载配置文件

Source

fn calculate_checksum<P: AsRef<Path>>( &self, path: P, algorithm: ChecksumAlgorithm, ) -> Result<ChecksumResult>

计算校验和

Source

fn calculate_checksums<P: AsRef<Path>>( &self, path: P, algorithms: &[ChecksumAlgorithm], ) -> Result<Vec<ChecksumResult>>

计算多个校验和

Source

fn verify_checksum<P: AsRef<Path>>( &self, path: P, expected: &str, algorithm: ChecksumAlgorithm, ) -> Result<bool>

验证文件完整性

Source

fn diff<P: AsRef<Path>, Q: AsRef<Path>>( &self, source: P, target: Q, ) -> Result<DiffResult>

比较两个文件的元数据

Source

fn diff_tags<P: AsRef<Path>, Q: AsRef<Path>>( &self, source: P, target: Q, tags: &[TagId], ) -> Result<DiffResult>

比较两个文件的元数据(仅特定标签)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§