rvimage 0.6.8

A remote image viewer with a labeling tool
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod server;
use rvimage_domain::{RvResult, to_rv};
use serde::Serialize;
pub use server::{CmdServer, WandServer};

pub fn serialize_or_default<T: Default + Serialize>(x: Option<&T>) -> RvResult<String> {
    {
        if let Some(x) = x {
            serde_json::to_string(x)
        } else {
            serde_json::to_string(&T::default())
        }
    }
    .map_err(to_rv)
}