Skip to main content

Content

Trait Content 

Source
pub trait Content {
    // Required methods
    fn workarea(&self, ctx: &GitContext) -> Result<GitWorkArea, WorkAreaError>;
    fn sha1(&self) -> Option<&CommitId>;
    fn diffs(&self) -> &Vec<DiffInfo>;
    fn path_diff(&self, path: &FileName) -> Result<String, CommitError>;

    // Provided method
    fn modified_files(&self) -> Vec<&FileName> { ... }
}
Expand description

A trait for representing the content of a diff.

This may be used for checks which do not require any metadata.

Required Methods§

Source

fn workarea(&self, ctx: &GitContext) -> Result<GitWorkArea, WorkAreaError>

A workarea which may be used to work on the content.

Source

fn sha1(&self) -> Option<&CommitId>

The SHA1 of the commit (if the content is of a commit).

Source

fn diffs(&self) -> &Vec<DiffInfo>

The differences in the content.

Source

fn path_diff(&self, path: &FileName) -> Result<String, CommitError>

Get the patch difference for the given path.

Provided Methods§

Source

fn modified_files(&self) -> Vec<&FileName>

Return a vector of files modified in a diff.

This excludes paths which are either not actually files (e.g., submodules and symlinks), as well as paths which were deleted in this commit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§