use crate::*;
use print::
{
InputExtract,
Context,
};
use core::
{
fmt,
};
use std::sync::OnceLock;
#[ derive( Debug ) ]
pub struct Keys
{
}
impl Keys
{
pub fn instance() -> &'static dyn TableOutputFormat
{
static INSTANCE : OnceLock< Keys > = OnceLock::new();
INSTANCE.get_or_init( || Keys::default() )
}
}
impl Default for Keys
{
fn default() -> Self
{
Self
{
}
}
}
impl TableOutputFormat for Keys
{
fn extract_write< 'buf, 'data >(
&self,
x : &InputExtract< 'data >,
c : &mut Context< 'buf >,
) -> fmt::Result
{
for col in &x.col_descriptors
{
write!( c.buf, " - {}\n", col.label )?;
}
write!( c.buf, " {} fields\n", x.col_descriptors.len() )?;
Ok(())
}
}