[][src]Crate cachedir

A Rust library to help interacting with cache directories and CACHEDIR.TAG files as defined in Cache Directory Tagging Specification.

The abstract of the spefication should be more than enough to illustrate what we're doing here:

Many applications create and manage directories containing cached information about content stored elsewhere, such as cached Web content or thumbnail-size versions of images or movies. For speed and storage efficiency we would often like to avoid backing up, archiving, or otherwise unnecessarily copying such directories around, but it is a pain to identify and individually exclude each such directory during data transfer operations. I propose an extremely simple convention by which applications can reliably "tag" any cache directories they create, for easy identification by backup systems and other data management utilities. Data management utilities can then heed or ignore these tags as the user sees fit.

Enums

TagState

The state of a CACHEDIR.TAG file.

Constants

HEADER

The CACHEDIR.TAG file header as defined by the specification.

Functions

add_tag

Adds a tag to the specified directory.

ensure_tag

Ensures the tag exists in directory.

get_tag_state

Gets the state of the tag in the specified directory.

is_tagged

Returns true if the tag is present at directory, false otherwise. This is basically a shortcut for

mkdir_atomic

Tries to create directory with a CACHEDIR.TAG file atomically and returns true if it created it or false if the directory already exists, regardless of if the CACHEDIR.TAG file exists in it or if it has the correct header.