hostab 0.0.1

Your dev tool to manage /etc/hosts like a pro — written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::core::model::Row;
use serde::Serialize;

/// Format rows as JSON
pub fn format_json<T: Serialize>(data: &T) -> String {
    serde_json::to_string_pretty(data).unwrap_or_else(|e| format!("JSON error: {}", e))
}

/// Format rows as JSON array
pub fn format_json_rows(rows: &[Row]) -> String {
    serde_json::to_string_pretty(rows).unwrap_or_else(|e| format!("JSON error: {}", e))
}