Skip to main content

Format

Enum Format 

Source
pub enum Format {
Show 16 variants DuckBox, Box, Table, Markdown, Line, List, Csv, Tsv, Json, JsonLines, Quote, Insert, Html, Ascii, Column, Trash,
}
Expand description

What a result is printed as.

Variants§

§

DuckBox

The default. A box with the column types under the names and a row count under the table.

§

Box

A box without the type row and without the row count.

§

Table

The same table drawn in +, - and |.

§

Markdown

A GitHub flavoured markdown table.

§

Line

One name = value per line, a blank line between rows.

§

List

Values joined by the separator, which defaults to a pipe.

§

Csv

Comma separated, with the quoting rules of RFC 4180.

§

Tsv

Tab separated.

§

Json

One JSON array of objects.

§

JsonLines

One JSON object per line.

§

Quote

Single quoted values, comma separated, in the spelling SQL wants.

§

Insert

One INSERT statement per row.

§

Html

Table rows and cells as HTML, without the surrounding table element, which is what DuckDB emits.

§

Ascii

One value per line, columns first, no decoration at all.

§

Column

Space padded columns under a dashed rule.

§

Trash

Nothing at all, for timing a query without paying to print it.

Implementations§

Source§

impl Format

Source

pub fn from_name(name: &str) -> Option<Self>

The mode of that name, or None if there is no such mode.

Source

pub fn from_flag(name: &str) -> Option<Self>

The mode a command line flag names, or None when there is no flag of that name.

Twelve of the sixteen modes are also flags and four of them are not, and the four are an error rather than a mode. This is upstream’s list rather than a rule, so it is written out rather than derived: duckdb -help has a line for each of these twelve and no line for -duckbox, -insert, -tabs or -trash, and asking v2.0.0-dev84237 for any of those four gets Unrecognized option and a non zero exit. The aliases are not flags either, so -lines, -tsv and -ndjson are refused while .mode lines is still accepted. Per #238.

Source

pub fn name(self) -> &'static str

The name this mode answers to, which is what .show prints.

Trait Implementations§

Source§

impl Clone for Format

Source§

fn clone(&self) -> Format

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Format

Source§

impl Debug for Format

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Format

Source§

fn default() -> Format

Returns the “default value” for a type. Read more
Source§

impl Eq for Format

Source§

impl PartialEq for Format

Source§

fn eq(&self, other: &Format) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Format

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.