Skip to main content

Crate numby

Crate numby 

Source
Expand description

§Numby Library

This library provides the core functionality for the Numby natural language calculator.

§Modules

  • config: Configuration loading and management.
  • evaluator: Expression evaluation and conversions.
  • models: Data structures and state management.
  • parser: Parsing utilities and regex replacements.
  • conversions: Unit and currency conversion functions.
  • prettify: Number formatting for display.
  • security: Path validation and input sanitization.
  • i18n: Internationalization and localization support.

Modules§

config
Configuration management for Numby calculator.
conversions
Unit and currency conversion functions.
currency_fetcher
Currency exchange rate fetching from external APIs.
evaluator
Expression evaluation and agent registry.
highlight
i18n
line_groups
models
Core data structures for application state and agents.
parser
Expression parsing and preprocessing utilities.
prettify
Number formatting utilities for pretty display.
security
Security utilities for input validation and path sanitization.

Macros§

fl
Macro for easy localization without arguments

Structs§

NumbyHighlightSpan

Functions§

libnumby_are_rates_stale
Checks if currency rates are stale (older than 24 hours)
libnumby_clear_history⚠
Safety
libnumby_clear_variables⚠
Clear all variables from the context
libnumby_complete_variable⚠
Return the common completion suffix for the variable at a UTF-16 cursor offset. The caller frees the returned string with libnumby_free_string.
libnumby_context_free⚠
Safety
libnumby_context_new
libnumby_evaluate⚠
Safety
libnumby_free_highlight_spans⚠
Frees highlight spans returned by libnumby_highlight_spans.
libnumby_free_string⚠
Safety
libnumby_get_api_rates_date
Gets the API rates date (when the rates were published by the API)
libnumby_get_default_config_path
Returns the default config path used by the Rust core.
libnumby_get_history_count⚠
Safety
libnumby_get_locale⚠
Get the current locale
libnumby_get_locale_code⚠
Get locale code at index
libnumby_get_locale_name⚠
Get locale display name at index
libnumby_get_locales_count⚠
Get the number of available locales
libnumby_get_rates_update_date
Gets the last update date for currency rates (when we last fetched)
libnumby_group_bounds_for_cursor⚠
Returns the start/end line indices for the multiline group containing the cursor.
libnumby_group_expr_for_cursor⚠
Returns the multiline group expression containing the cursor.
libnumby_highlight_spans⚠
Returns a heap-allocated array of highlight spans. Caller must free using libnumby_free_highlight_spans.
libnumby_load_config⚠
Safety
libnumby_set_currency_rates_json⚠
Sets currency rates from JSON data provided by the caller (e.g., from Swift URLSession)
libnumby_set_locale⚠
Safety
libnumby_set_number_format⚠
Safety
libnumby_set_variable⚠
Safety
libnumby_update_currency_rates⚠
Fetches latest currency rates from the API and updates the config file