Struct rif::rel::Relations [−][src]
pub struct Relations {
pub files: HashMap<PathBuf, SingleFile>,
}
Expand description
Relations is a struct that stores all information about rif
Fields
files: HashMap<PathBuf, SingleFile>
Implementations
Display a single file as human readable form
Args
path
- A file path(name) to display
Display format
> <FILE_NAME>
Only display stale files
Print a single file’s relation
Args
path
- File name to printdepth
- Desired depth value to display
Add file to rif list
Fails when path doesn’t exist. Sanity is checked after addition.
Args
file_path
- A file path to add
Remove file from rif
Path validity doesn’t matter.
Args
file_path
- File path(name) to remove from rif.
Rename a file in rif
This operation require new_name path does exists and doesn’t check path of old_name
Args
file_path
- File path(name) to rename.new_name
- New file name to apply
Update filestamp of file
Update file’s timestamp and last modified time into file’s system last modified time.
Args
file_path
- File path(name) to update timestamp
Forcefully update filestamp of file
Update file’s timestamp into current unix time.
Args
file_path
- File path(name) to update timestamp
Discard file modification
Retain file’s timestamp and only update last modified time.
Args
file_path
- File path(name) to discard modification
Set references to a file
This is union operation thus existing files are not affected. References should be existent in rif list to be added to a file.
Args
file_path
- File path(name) to add referencesref_files
- File pahts to set as references
Unset references from a file
This is minus operation thus references don’t have to be valid path.
Args
file_path
- File path(name) to discard modificationref_files
- File pahts to unset as references
pub fn set_file_status(
&mut self,
file_path: &Path,
file_status: FileStatus
) -> Result<(), RifError>
pub fn set_file_status(
&mut self,
file_path: &Path,
file_status: FileStatus
) -> Result<(), RifError>
Set status for a file
Args
file_path
- File path(name) to set a statusfile_status
- File status to set for the file
Check sanity of rif list
Sanity is assured when: file is not referencing itself, file referencing conclues to infinite loop
Fix invalid format so that sanity can be retained.
Repeatedly find invalid referecning and fix until sanity check succeeds.
pub fn track_modified_files<'a>(
&'a self,
to_be_added_later: impl IntoIterator<Item = &'a PathBuf> + 'a
) -> Result<(), RifError>
pub fn track_modified_files<'a>(
&'a self,
to_be_added_later: impl IntoIterator<Item = &'a PathBuf> + 'a
) -> Result<(), RifError>
Track and print modified files
Modfication is determined by comparing rif’s last modified and system’s modifid time. If rif’s last modified time is oldere than system’s modified time, it is considered as modified.
Get list of modified files
Logic is very similar to track_modified_files but it returns list of modified files.
Track and display unregistered files
Unregistered file is a file which exists in under directory where rif file resides.
Args
black_list
- Blacklists to to ignore when tracking unregistered files
Read rif file and return rif list
Read rif file without sanity check
Trait Implementations
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