Expand description
§smartcols-sys: Unsafe Rust bindings for libsmartcols
libsmartcols helps format tables when structured data is output.
This crate is Linux-specific. Building it for non-Linux platforms, or for the Linux kernel, results in an empty crate.
This crate links to libsmartcols, and requires it to be installed.
See below for example installation instructions.
§Installing libsmartcols
This crate links to libsmartcols, and requires it to be installed.
The library, its C header files, and the clang compiler need to be installed on the build machine.
On Debian, for example, one can install that as follows:
sudo apt-get install clang libsmartcols-devIf the library is linked dynamically (most typical configuration), then it needs to be installed on the target computer in order to run the resulting program. On Debian, for example, one can install it as follows:
sudo apt-get install libsmartcols1§Supported environment variables
This crate depends on some environment variables, and variants of those.
For each environment variable (e.g., CC), the following are the accepted
variants of it:
<var>_<target>, e.g.,CC_aarch64-unknown-linux-gnu.<var>_<target-with-underscores>, e.g.,CC_aarch64_unknown_linux_gnu.TARGET_<var>, e.g.,TARGET_CC.<var>, e.g.,CC.
The following environment variables (and their variants) affect how this crate is built:
SMARTCOLS_STATICSMARTCOLS_PATHSMARTCOLS_INCLUDE_DIRSMARTCOLS_LIB_DIRSYSROOTCCCFLAGS
§Dynamic or static linking
This crate links to libsmartcols dynamically if possible, except when targeting
platforms based on the musl C library.
This behavior can be changed either by setting the environment variable
SMARTCOLS_STATIC to 1, or by enabling the crate feature static.
If both are defined, then the value of SMARTCOLS_STATIC takes precedence.
Setting SMARTCOLS_STATIC to 0 mandates dynamic linking.
§Finding smartcols library and headers
By default, this crate finds smartcols headers and library based on the default target C compiler.
This behavior can be changed by:
- Either defining the environment variable
SMARTCOLS_PATHto the path of a directory containing the sub-directoriesincludeandlibwhere the headers and library are installed. - Or by defining one or both of the environment variables
SMARTCOLS_INCLUDE_DIRandSMARTCOLS_LIB_DIRto paths to the directories where headers and library are present. IfSMARTCOLS_PATHis also defined, thenSMARTCOLS_INCLUDE_DIRandSMARTCOLS_LIB_DIRtake precedence.
§Depending on this crate
This crate provides the following variables to other crates that depend on it:
DEP_SMARTCOLS_INCLUDE: Path of the directory where library C header files reside.DEP_SMARTCOLS_LIB: Path of the directory where the library binary resides.
§Documentation-only build mode
The documentation-only build mode allows building documentation even if
libsmartcols and its headers are unavailable.
To build in this mode, set the environment variable DOCS_RS to 1:
env DOCS_RS=1 cargo doc --openThe generated documentation is based on libsmartcols version 2.40.4.
⚠️ The generated crate might be unusable in this mode.
§Versioning
This project adheres to Semantic Versioning.
The CHANGELOG.md file details notable changes over time.
Structs§
- libscols_
cell - libscols_cell:
- libscols_
column - libscols_column:
- libscols_
counter - libscols_counter:
- libscols_
filter - libscols_filter:
- libscols_
iter - libscols_iter:
- libscols_
line - libscols_line:
- libscols_
symbols - libscols_symbols:
- libscols_
table - libscols_table:
Constants§
- LIBSMARTCOLS_
VERSION - SCOLS_
CELL_ FL_ CENTER - SCOLS_
CELL_ FL_ LEFT - SCOLS_
CELL_ FL_ RIGHT - SCOLS_
COUNTER_ COUNT - SCOLS_
COUNTER_ MAX - SCOLS_
COUNTER_ MIN - SCOLS_
COUNTER_ SUM - SCOLS_
DATA_ BOOLEAN - SCOLS_
DATA_ FLOAT - SCOLS_
DATA_ NONE - SCOLS_
DATA_ STRING - SCOLS_
DATA_ U64 - SCOLS_
DEBUG_ ALL - SCOLS_
DEBUG_ BUFF - SCOLS_
DEBUG_ CELL - SCOLS_
DEBUG_ COL - SCOLS_
DEBUG_ FLTR - SCOLS_
DEBUG_ FPARAM - SCOLS_
DEBUG_ GROUP - SCOLS_
DEBUG_ HELP - SCOLS_
DEBUG_ INIT - SCOLS_
DEBUG_ LINE - SCOLS_
DEBUG_ TAB - SCOLS_
FL_ HIDDEN - SCOLS_
FL_ NOEXTREMES - SCOLS_
FL_ RIGHT - SCOLS_
FL_ STRICTWIDTH - SCOLS_
FL_ TREE - SCOLS_
FL_ TRUNC - SCOLS_
FL_ WRAP - SCOLS_
ITER_ BACKWARD - SCOLS_
ITER_ FORWARD - SCOLS_
JSON_ ARRAY_ NUMBER - SCOLS_
JSON_ ARRAY_ STRING - SCOLS_
JSON_ BOOLEAN - SCOLS_
JSON_ BOOLEAN_ OPTIONAL - SCOLS_
JSON_ FLOAT - SCOLS_
JSON_ NUMBER - SCOLS_
JSON_ STRING - SCOLS_
TERMFORCE_ ALWAYS - SCOLS_
TERMFORCE_ AUTO - SCOLS_
TERMFORCE_ NEVER - __
SCOLS_ NCOUNTES
Functions§
- scols_
cell_ ⚠copy_ content - scols_
cell_ ⚠get_ alignment - scols_
cell_ ⚠get_ color - scols_
cell_ ⚠get_ data - scols_
cell_ ⚠get_ datasiz - scols_
cell_ ⚠get_ flags - scols_
cell_ ⚠get_ userdata - scols_
cell_ ⚠refer_ data - scols_
cell_ ⚠refer_ memory - scols_
cell_ ⚠set_ color - scols_
cell_ ⚠set_ data - scols_
cell_ ⚠set_ flags - scols_
cell_ ⚠set_ userdata - scols_
cmpstr_ ⚠cells - scols_
column_ ⚠get_ color - scols_
column_ ⚠get_ data_ type - scols_
column_ ⚠get_ flags - scols_
column_ ⚠get_ header - scols_
column_ ⚠get_ json_ type - scols_
column_ ⚠get_ name - scols_
column_ ⚠get_ name_ as_ shellvar - scols_
column_ ⚠get_ safechars - scols_
column_ ⚠get_ table - scols_
column_ ⚠get_ whint - scols_
column_ ⚠get_ width - scols_
column_ ⚠get_ wrap_ data - scols_
column_ ⚠has_ data_ func - scols_
column_ ⚠is_ customwrap - scols_
column_ ⚠is_ hidden - scols_
column_ ⚠is_ noextremes - scols_
column_ ⚠is_ right - scols_
column_ ⚠is_ strict_ width - scols_
column_ ⚠is_ tree - scols_
column_ ⚠is_ trunc - scols_
column_ ⚠is_ wrap - scols_
column_ ⚠set_ cmpfunc - scols_
column_ ⚠set_ color - scols_
column_ ⚠set_ data_ func - scols_
column_ ⚠set_ data_ type - scols_
column_ ⚠set_ flags - scols_
column_ ⚠set_ json_ type - scols_
column_ ⚠set_ name - scols_
column_ ⚠set_ properties - scols_
column_ ⚠set_ safechars - scols_
column_ ⚠set_ whint - scols_
column_ ⚠set_ wrapfunc - scols_
copy_ ⚠column - scols_
copy_ ⚠line - scols_
copy_ ⚠symbols - scols_
copy_ ⚠table - scols_
counter_ ⚠get_ name - scols_
counter_ ⚠get_ result - scols_
counter_ ⚠set_ func - scols_
counter_ ⚠set_ name - scols_
counter_ ⚠set_ param - scols_
dump_ ⚠filter - scols_
filter_ ⚠assign_ column - scols_
filter_ ⚠get_ errmsg - scols_
filter_ ⚠new_ counter - scols_
filter_ ⚠next_ counter - scols_
filter_ ⚠next_ holder - scols_
filter_ ⚠parse_ string - scols_
filter_ ⚠set_ filler_ cb - scols_
free_ ⚠iter - scols_
get_ ⚠library_ version - scols_
init_ ⚠debug - scols_
iter_ ⚠get_ direction - scols_
line_ ⚠add_ child - scols_
line_ ⚠alloc_ cells - scols_
line_ ⚠apply_ filter - scols_
line_ ⚠free_ cells - scols_
line_ ⚠get_ cell - scols_
line_ ⚠get_ color - scols_
line_ ⚠get_ column_ cell - scols_
line_ ⚠get_ column_ data - scols_
line_ ⚠get_ ncells - scols_
line_ ⚠get_ parent - scols_
line_ ⚠get_ userdata - scols_
line_ ⚠has_ children - scols_
line_ ⚠is_ ancestor - scols_
line_ ⚠is_ filled - scols_
line_ ⚠link_ group - scols_
line_ ⚠next_ child - scols_
line_ ⚠refer_ column_ data - scols_
line_ ⚠refer_ data - scols_
line_ ⚠remove_ child - scols_
line_ ⚠set_ color - scols_
line_ ⚠set_ column_ data - scols_
line_ ⚠set_ data - scols_
line_ ⚠set_ userdata - scols_
new_ ⚠column - scols_
new_ ⚠filter - scols_
new_ ⚠iter - scols_
new_ ⚠line - scols_
new_ ⚠symbols - scols_
new_ ⚠table - scols_
parse_ ⚠version_ string - scols_
print_ ⚠table - scols_
print_ ⚠table_ to_ string - scols_
ref_ ⚠column - scols_
ref_ ⚠filter - scols_
ref_ ⚠line - scols_
ref_ ⚠symbols - scols_
ref_ ⚠table - scols_
reset_ ⚠cell - scols_
reset_ ⚠iter - scols_
shellvar_ ⚠name - scols_
sort_ ⚠table - scols_
sort_ ⚠table_ by_ tree - scols_
symbols_ ⚠set_ branch - scols_
symbols_ ⚠set_ cell_ padding - scols_
symbols_ ⚠set_ group_ first_ member - scols_
symbols_ ⚠set_ group_ horizontal - scols_
symbols_ ⚠set_ group_ last_ child - scols_
symbols_ ⚠set_ group_ last_ member - scols_
symbols_ ⚠set_ group_ middle_ child - scols_
symbols_ ⚠set_ group_ middle_ member - scols_
symbols_ ⚠set_ group_ vertical - scols_
symbols_ ⚠set_ right - scols_
symbols_ ⚠set_ title_ padding - scols_
symbols_ ⚠set_ vertical - scols_
table_ ⚠add_ column - scols_
table_ ⚠add_ line - scols_
table_ ⚠colors_ wanted - scols_
table_ ⚠enable_ ascii - scols_
table_ ⚠enable_ colors - scols_
table_ ⚠enable_ export - scols_
table_ ⚠enable_ header_ repeat - scols_
table_ ⚠enable_ json - scols_
table_ ⚠enable_ maxout - scols_
table_ ⚠enable_ minout - scols_
table_ ⚠enable_ noencoding - scols_
table_ ⚠enable_ noheadings - scols_
table_ ⚠enable_ nolinesep - scols_
table_ ⚠enable_ nowrap - scols_
table_ ⚠enable_ raw - scols_
table_ ⚠enable_ shellvar - scols_
table_ ⚠get_ column - scols_
table_ ⚠get_ column_ by_ name - scols_
table_ ⚠get_ column_ separator - scols_
table_ ⚠get_ cursor - scols_
table_ ⚠get_ line - scols_
table_ ⚠get_ line_ separator - scols_
table_ ⚠get_ name - scols_
table_ ⚠get_ ncols - scols_
table_ ⚠get_ nlines - scols_
table_ ⚠get_ stream - scols_
table_ ⚠get_ symbols - scols_
table_ ⚠get_ termforce - scols_
table_ ⚠get_ termheight - scols_
table_ ⚠get_ termwidth - scols_
table_ ⚠get_ title - scols_
table_ ⚠group_ lines - scols_
table_ ⚠is_ ascii - scols_
table_ ⚠is_ empty - scols_
table_ ⚠is_ export - scols_
table_ ⚠is_ header_ repeat - scols_
table_ ⚠is_ json - scols_
table_ ⚠is_ maxout - scols_
table_ ⚠is_ minout - scols_
table_ ⚠is_ noencoding - scols_
table_ ⚠is_ noheadings - scols_
table_ ⚠is_ nolinesep - scols_
table_ ⚠is_ nowrap - scols_
table_ ⚠is_ raw - scols_
table_ ⚠is_ shellvar - scols_
table_ ⚠is_ tree - scols_
table_ ⚠move_ column - scols_
table_ ⚠new_ column - scols_
table_ ⚠new_ line - scols_
table_ ⚠next_ column - scols_
table_ ⚠next_ line - scols_
table_ ⚠print_ range - scols_
table_ ⚠print_ range_ to_ string - scols_
table_ ⚠reduce_ termwidth - scols_
table_ ⚠remove_ column - scols_
table_ ⚠remove_ columns - scols_
table_ ⚠remove_ line - scols_
table_ ⚠remove_ lines - scols_
table_ ⚠set_ column_ separator - scols_
table_ ⚠set_ columns_ iter - scols_
table_ ⚠set_ default_ symbols - scols_
table_ ⚠set_ line_ separator - scols_
table_ ⚠set_ name - scols_
table_ ⚠set_ stream - scols_
table_ ⚠set_ symbols - scols_
table_ ⚠set_ termforce - scols_
table_ ⚠set_ termheight - scols_
table_ ⚠set_ termwidth - scols_
unref_ ⚠column - scols_
unref_ ⚠filter - scols_
unref_ ⚠line - scols_
unref_ ⚠symbols - scols_
unref_ ⚠table - scols_
wrapnl_ ⚠chunksize - scols_
wrapnl_ ⚠nextchunk - scols_
wrapzero_ ⚠nextchunk