proxmox-rest-server: cleanup formatter, improve docs

Use trait for OutputFormatter. This is functionally equivalent,
but more rust-like...
This commit is contained in:
Dietmar Maurer
2021-09-27 12:59:06 +02:00
parent 8a23ea4656
commit 53daae8e89
8 changed files with 128 additions and 98 deletions

View File

@ -18,7 +18,7 @@ pub struct ReaderEnvironment {
result_attributes: Value,
auth_id: Authid,
pub debug: bool,
pub formatter: &'static OutputFormatter,
pub formatter: &'static dyn OutputFormatter,
pub worker: Arc<WorkerTask>,
pub datastore: Arc<DataStore>,
pub backup_dir: BackupDir,
@ -42,7 +42,7 @@ impl ReaderEnvironment {
worker,
datastore,
debug: false,
formatter: &JSON_FORMATTER,
formatter: JSON_FORMATTER,
backup_dir,
allowed_chunks: Arc::new(RwLock::new(HashSet::new())),
}