Skip to content

Python and Rust wrappers

Compare
Choose a tag to compare
@matajoh matajoh released this 19 Sep 00:23
· 15 commits to main since this release
26fd07d

This release marks the first versions of the Rust and Python APIs, along with their example code.

Adding new examples for Python and Rust usage.

Python API

  • wrappers/python/ contains a Python package, regopy, which wraps the library
    and exposes a Python API. It is published on PyPi here

Rust API

  • wrappers/rust/ contains a Rust crate, regorust, which wraps the library
    and exposes a Rust API. It is published on crates.io here

Bug Fixes

  • Fixed a bug where to_json() was incorrectly sorting arrays when the sort
    flag was set to true.
  • Removes a memory leak caused by a cyclic graph of Unifiers
  • Fixes various use-after-free violations caused by missing clone() invocations.

New Features

  • The C++ API is now documented using Doxygen. The documentation can be found
    here.
  • Logging levels have been added and can be set via the API (instead of just
    binary enabled/disabled)
  • The library can now be built to target the C++ 17 standard (for older compilers)

Breaking changes

  • C API: The regoSetLoggingEnabled function has been replaced with
    regoSetLoggingLevel. This is also reflected in the C++ and Rust APIs.h
  • C API: The regoSetExecutablePath function has been removed due to the
    Interpreter::executable() property being removed from the C++ API.
  • The to_json method flag rego_set has been changed to set_as_array and
    the order of its flag inverted (it is now false by default).
  • C API: The regoAddInput* functions are now named regoSetInput* and can
    be used multiple times on the same interpreter.
  • C API: regoGet/SetStrictBuiltInErrors has been added.
  • The public headers have been reduced to just two files:
    • rego.hh which contains the C++ API
    • rego_c.h which contains the C API
  • The rego.hh header is now a C++ header and will not compile in C.
  • Many definitions have been moved to the (non-public) internal.hh header,
    and code which relied on having access to those definitions will break.