pub type Result<T> = Result<T, Error>;Expand description
A specialized Result type for read and write operations
for the abcrypt encrypted data format.
§Examples
use abcrypt::{Decryptor, Encryptor};
fn encrypt(plaintext: &[u8], passphrase: &[u8]) -> abcrypt::Result<Vec<u8>> {
Encryptor::new(&plaintext, passphrase).map(|c| c.encrypt_to_vec())
}
fn decrypt(ciphertext: &[u8], passphrase: &[u8]) -> abcrypt::Result<Vec<u8>> {
Decryptor::new(&ciphertext, passphrase).and_then(|c| c.decrypt_to_vec())
}
let data = b"Hello, world!\n";
let passphrase = b"passphrase";
let ciphertext = encrypt(data, passphrase).unwrap();
assert_ne!(ciphertext, data);
let plaintext = decrypt(&ciphertext, passphrase).unwrap();
assert_eq!(plaintext, data);Aliased Type§
pub enum Result<T> {
Ok(T),
Err(Error),
}