XU XUv0.8.8
中文

API

#text/tabwriter

import: #text/tabwriter

counts: 1 fns, 2 methods, 2 types, 2 consts, 0 ifaces

Elastic tabstops: write + flush returns a string.

const align_right

XuAPI
pub const align_right = 4

Purpose

Elastic tabstops aligned with `text/tabwriter` (Write + Flush). ASCII cell width = byte length. No HTML filter, no Escape, no formfeed flush. padchar tab (tabwidth alignment) is not implemented. flush returns the formatted owning string (no io.Writer). Cells store (start,len) into the raw buffer — not owning strings. read); widths stay intact. Offsets avoid that (see text_tabwriter). Value `4`.

Parameters

none

const debug

XuAPI
pub const debug = 32

Purpose

Public constant `debug`. Value `32`.

Parameters

none

struct Writer

XuAPI
pub struct Writer {
    pub minwidth int
    pub tabwidth int
    pub padding int
    pub padchar int
    pub flags int
    pub raw string
}

Purpose

Public struct `Writer`.

Parameters

minwidth int
field (int)
tabwidth int
field (int)
padding int
field (int)
padchar int
field (int)
flags int
field (int)
raw string
field (string)

struct Cell

XuAPI
pub struct Cell {
    pub text string
    pub width int
    pub htab int
}

Purpose

Public struct `Cell`.

Parameters

text string
text
width int
field (int)
htab int
field (int)

new_writer

XuAPI
pub fn new_writer(minwidth int, tabwidth int, padding int, padchar int, flags int) Writer

Purpose

Construct writer.

Parameters

minwidth int
minwidth (int)
tabwidth int
tabwidth (int)
padding int
padding (int)
padchar int
padchar (int)
flags int
flags (int)

Returns

Writer — a value of this type

(&mut Writer) write

XuAPI
pub fn (w &mut Writer) write(s &string)

Purpose

Method on `&mut Writer`: write data and return the byte count.

Parameters

w &mut Writer
receiver &mut Writer (exclusive borrow)
s &string
source string (borrowed; caller keeps it; type &string)

(&mut Writer) flush

XuAPI
pub fn (w &mut Writer) flush() string

Purpose

Method on `&mut Writer`: flush buffered data.

Parameters

w &mut Writer
receiver &mut Writer (exclusive borrow)

Returns

string — result string