cbor-cli 0.5.0

Command line tool for encoding and decoding CBOR using serde. Supports import and export for JSON, YAML, and TOML. Supports deep inspection of CBOR files.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::io::{self, Stdout};

/// A generic write method for a specific type.
pub trait WriteStr<T> {
  fn write_str(&mut self, target: T) -> io::Result<()>;
}

/// If they write to the Terminal, then write to Stdout.
impl<T: std::fmt::Display> WriteStr<T> for Stdout {
  fn write_str(&mut self, target: T) -> io::Result<()> {
    println!("{}", target);
    Ok(())
  }
}