Skip to main content

Module lib_util

Module lib_util 

Source
Expand description

General utility functions used across the crate.

These functions are ported from Go lib.go and do not depend on the File struct. File-specific helpers live in file.rs and excelize.rs.

Structs§

Stack
A simple stack abstraction.

Functions§

bool_ptr
Returns a reference-counted pointer-like Box containing true or false.
bstr_marshal
Encodes characters as binary basic string escapes so that the value can be stored in an XML 1.0 document.
bstr_unmarshal
Parses the binary basic string, trimming escaped literals which are not permitted in an XML 1.0 document. Escapes have the form _xHHHH_.
cell_name_to_coordinates
Converts an alphanumeric cell name to [col, row] coordinates.
cell_refs_to_coordinates
Converts two cell references to a coordinate tuple.
column_name_to_number
Converts an Excel column name to a 1-based column number.
column_number_to_name
Converts a 1-based column number to an Excel column name.
coordinates_to_cell_name
Converts [col, row] coordinates to an alphanumeric cell name.
coordinates_to_range_ref
Converts a coordinate tuple back to a range reference.
count_utf16_string
Counts the number of UTF-16 code units in a string.
flat_sqref
Converts a reference sequence such as "A1 A2:B3" to a map of column number to a sorted list of [col, row] coordinates.
float64_ptr
Returns a Some wrapper for a f64 value.
float_to_frac_use_continued_fraction
Converts a floating-point decimal to a fraction using continued fractions and recurrence relations.
float_to_fraction
Converts a floating-point number to a fraction string representation with the specified placeholder widths for numerator and denominator.
in_coordinates
Returns the index of x in the coordinate list a, or -1 if not found.
in_float64_slice
Returns the index of x in a, or -1 if not found.
in_str_slice
Returns the index of x in a, or -1 if not found.
int_ptr
Returns a Some wrapper for an integer value.
is_numeric
Determines whether s is a valid numeric expression and returns its precision and value.
join_cell_name
Joins column name and row number into a cell name.
range_ref_to_coordinates
Converts a range reference such as "A1:B2" to [x1, y1, x2, y2].
sort_coordinates
Corrects a cell range so that the top-left and bottom-right corners are ordered correctly.
split_cell_name
Splits a cell name into column name and row number.
str_map
Helper to build a HashMap<String, String> from a static slice of pairs.
string_ptr
Returns a Some wrapper for a string value.
truncate_utf16_units
Truncates a string to a maximum number of UTF-16 code units.
uint_ptr
Returns a Some wrapper for an unsigned 32-bit value.