[−][src]Crate clircle
The clircle
crate helps you detect IO circles in your CLI applications.
Imagine you want to read data from a couple of files and output something according to the contents of these files. If the user redirects the output of your program to one of the input files, you might end up in an infinite circle of reading and writing.
The crate provides the struct Identifier
which is a platform dependent type alias, so that
you can use it on all platforms and do not need to introduce any conditional compilation
yourself.
On both Unix and Windows systems, Identifier
holds information to identify a file on a disk.
The Clircle
trait is implemented on both of these structs and requires TryFrom
for the
clircle::Stdio
enum and for &Path
, so that all possible inputs can be represented as an
Identifier
.
Finally, Clircle
is a subtrait of Eq
, so that the identifiers can be conveniently compared
and circles can be detected.
The clircle
crate also provides some convenience functions around the comparison of Clircle
implementors.
Re-exports
pub use clircle_unix::nix; |
Structs
UnixIdentifier | Implementation of |
Enums
Stdio | The three stdio streams. |
Traits
Clircle | The |
Functions
output_among_inputs | Finds a common |
stdout_among_inputs | Finds |
Type Definitions
Identifier | Identifies a file. The type is aliased according to the target platform. |