diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-12-31 09:00:21 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-12-31 12:10:10 +0200 |
commit | acf1ba3f8f1492b961c9a6eb09eb93e882f5eb3f (patch) | |
tree | 1ce0288f878cac71990bb01f358d6035f1626c92 /src/cmd/chunk.rs | |
parent | 686e87981db210fa443404c8473dfe7a3f39b241 (diff) | |
download | obnam2-acf1ba3f8f1492b961c9a6eb09eb93e882f5eb3f.tar.gz |
docs: add documentation comments to crate
Also, make it an error for a public symbol to not be documented.
Sponsored-by: author
Diffstat (limited to 'src/cmd/chunk.rs')
-rw-r--r-- | src/cmd/chunk.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/chunk.rs b/src/cmd/chunk.rs index e0e91b1..445d23f 100644 --- a/src/cmd/chunk.rs +++ b/src/cmd/chunk.rs @@ -1,3 +1,5 @@ +//! The `encrypt-chunk` and `decrypt-chunk` subcommands. + use crate::chunk::DataChunk; use crate::chunkmeta::ChunkMeta; use crate::cipher::CipherEngine; @@ -6,19 +8,24 @@ use crate::error::ObnamError; use std::path::PathBuf; use structopt::StructOpt; +/// Encrypt a chunk. #[derive(Debug, StructOpt)] pub struct EncryptChunk { + /// The name of the file containing the cleartext chunk. #[structopt(parse(from_os_str))] filename: PathBuf, + /// Name of file where to write the encrypted chunk. #[structopt(parse(from_os_str))] output: PathBuf, + /// Chunk metadata as JSON. #[structopt()] json: String, } impl EncryptChunk { + /// Run the command. pub fn run(&self, config: &ClientConfig) -> Result<(), ObnamError> { let pass = config.passwords()?; let cipher = CipherEngine::new(&pass); @@ -35,19 +42,24 @@ impl EncryptChunk { } } +/// Decrypt a chunk. #[derive(Debug, StructOpt)] pub struct DecryptChunk { + /// Name of file containing encrypted chunk. #[structopt(parse(from_os_str))] filename: PathBuf, + /// Name of file where to write the cleartext chunk. #[structopt(parse(from_os_str))] output: PathBuf, + /// Chunk metadata as JSON. #[structopt()] json: String, } impl DecryptChunk { + /// Run the command. pub fn run(&self, config: &ClientConfig) -> Result<(), ObnamError> { let pass = config.passwords()?; let cipher = CipherEngine::new(&pass); |