#[cfg(feature = "cbor")]
pub mod cbor;
#[cfg(feature = "tabular")]
pub mod tabular;
#[cfg(feature = "toml")]
pub mod toml;
#[cfg(feature = "xml")]
pub mod xml;
#[cfg(feature = "yaml")]
pub mod yaml;
pub use jaq_json::write as json;
#[cfg(feature = "all")]
mod formats;
#[cfg(feature = "all")]
mod funs;
#[cfg(feature = "all")]
pub use formats::write;
#[cfg(feature = "all")]
pub use funs::funs;
use std::io::{self, IsTerminal, Write};
#[derive(Default)]
pub struct Writer {
pub format: crate::Format,
pub pp: json::Pp,
pub join: bool,
}
pub fn with_stdout<T>(stdout: &mut io::Stdout, f: impl FnOnce(&mut dyn Write) -> T) -> T {
if stdout.is_terminal() {
f(&mut stdout.lock())
} else {
f(&mut io::BufWriter::new(stdout.lock()))
}
}