netdig 0.0.5

Utilities for analyzing and aggregating CIDR blocks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::Output;
use anyhow::Result;
use serde::Serialize;

pub trait Json {
    /// # Errors
    ///
    /// Returns an error if anything goes wrong during serialization.
    fn to_json(&self) -> Result<String>;
}

impl<T: Serialize> Json for Vec<Output<T>> {
    fn to_json(&self) -> Result<String> {
        Ok(serde_json::to_string_pretty(self)?)
    }
}