src/backup/manifest.rs: rename into_string -> to_string

And do not consume self.
This commit is contained in:
Dietmar Maurer 2020-07-09 11:28:05 +02:00
parent 8b2ad84a25
commit dfa517ad6c
2 changed files with 3 additions and 3 deletions

View File

@ -186,7 +186,7 @@ impl BackupManifest {
}
/// Converts the Manifest into json string, and add a signature if there is a crypt_config.
pub fn into_string(self, crypt_config: Option<&CryptConfig>) -> Result<String, Error> {
pub fn to_string(&self, crypt_config: Option<&CryptConfig>) -> Result<String, Error> {
let mut manifest = serde_json::to_value(&self)?;
@ -262,7 +262,7 @@ fn test_manifest_signature() -> Result<(), Error> {
manifest.unprotected["note"] = "This is not protected by the signature.".into();
let text = manifest.into_string(Some(&crypt_config))?;
let text = manifest.to_string(Some(&crypt_config))?;
let manifest: Value = serde_json::from_str(&text)?;
let signature = manifest["signature"].as_str().unwrap().to_string();

View File

@ -1082,7 +1082,7 @@ async fn create_backup(
// create manifest (index.json)
// manifests are never encrypted, but include a signature
let manifest = manifest.into_string(crypt_config.as_ref().map(Arc::as_ref))
let manifest = manifest.to_string(crypt_config.as_ref().map(Arc::as_ref))
.map_err(|err| format_err!("unable to format manifest - {}", err))?;