std/tabwriter
On this page
Index
- const
FILTER_HTML - const
STRIP_ESCAPE - const
ALIGN_RIGHT - const
DISCARD_EMPTY_COLUMNS - const
TAB_INDENT - const
DEBUG - const
ESCAPE - type
TabWriter- method
TabWriter.write - method
TabWriter.flush
- method
- fn
writer
Constants
FILTER_HTML
const FILTER_HTML: Int = 1Flags (Go’s FilterHTML, StripEscape, AlignRight, DiscardEmptyColumns, TabIndent, Debug), added together.
STRIP_ESCAPE
const STRIP_ESCAPE: Int = 2ALIGN_RIGHT
const ALIGN_RIGHT: Int = 4DISCARD_EMPTY_COLUMNS
const DISCARD_EMPTY_COLUMNS: Int = 8TAB_INDENT
const TAB_INDENT: Int = 16DEBUG
const DEBUG: Int = 32ESCAPE
const ESCAPE: Int = 255The byte that starts and ends an escaped text (Go’s Escape): its bytes pass through as one piece of the cell, tabs and all.
Types
TabWriter
struct TabWriter {}A tab writer: text written to it is split into cells at its tabs
(\t, or \v; a line ends at \n or \f), and flush returns the
text with every column padded to the widest cell of its block of
lines, as Go’s tabwriter.Writer does. write takes bytes in any
pieces; the output it has formatted so far is held until flush
returns it (Go writes it to the io.Writer as lines complete).
@move_only
TabWriter.write
fn (var w: TabWriter) write(data: Bytes)TabWriter.flush
fn (var w: TabWriter) flush() -> BytesThe formatted output since the last flush; the writer is empty again.
Functions
writer
fn writer(min_width: Int, tab_width: Int, padding: Int, pad_char: Int = 32, flags: Int = 0) -> TabWriterGo’s NewWriter(output, minwidth, tabwidth, padding, padchar, flags):
min_width is the minimal cell width including padding, tab_width
the width of a tab (when pad_char is a tab), padding the cell
padding added to the text’s width, pad_char the byte padded with
(a space by default, 9 for tabs), and flags the flags added
together. A negative number faults.