thirdpass-core 0.3.1

Core library for the Thirdpass package code review system.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::extension::process::ProcessResult;
use anyhow::Result;

pub fn communicate_result<T: serde::Serialize>(result: Result<T>) -> Result<()> {
    let result = match result {
        Ok(r) => ProcessResult {
            ok: Some(r),
            err: None,
        },
        Err(e) => ProcessResult {
            ok: None,
            err: Some(e.to_string()),
        },
    };
    println!("{}", serde_json::to_string(&result)?);
    Ok(())
}