Skip to content

cjordan/rust-erfa

Repository files navigation

rust-erfa

Cross-platform%20tests

This project contains the crates erfa and erfa-sys, which allow usage of the ERFA library in Rust.

erfa

crates.io docs.rs

This crate is a pure-Rust equivalent to the ERFA C library. The C library is relatively easy to re-write as it has no dependencies, and it is convenient to have a Rust-re-written library to avoid complications during C library installation.

However, it is currently incomplete. I've implemented many functions but only the ones I need. Please file a PR or issue if you require more.

This library is tested against erfa-sys, effectively meaning that the results are the same as the original C library.

erfa-sys

crates.io docs.rs

This crate provides direct bindings to the ERFA C library. It is possible to build the library from C sources, such that the user's system does not need the ERFA C library available as a prerequisite - see static linking below.

Static linking

This crate supports linking to a static build of ERFA. The advantage of doing this is that you don't need the ERFA library available as a system library at runtime.

Static linking can be done in two ways. The first is by using the static feature when building erfa-sys; this compiles the bundled ERFA source code using your own C compiler.

The second way to link ERFA statically is by providing a liberfa.a library. Either the ERFA_STATIC or PKG_CONFIG_ALL_STATIC environment variable need to be set to 1. The directory containing this file (or the liberfa.so file) can be specified with ERFA_LIB. If ERFA_LIB isn't found, then pkg-config is used to search for the library.

Updating the provided ERFA source code

The ext directory contains a git submodule of the ERFA repo. If the source code needs to be changed, then the git submodule can use a different commit.

If new ERFA functions or constants are introduced, then gen_rust_include.sh should also be run.

Windows

I don't know how to run/bind to ERFA on Windows, so this crate may not work there. Pull requests welcome.

Acknowledgement

This crate was made with a lot of help and inspiration from the hdf5-rust crate family.

About

The Rust interface to the ERFA library

Resources

License

MPL-2.0, Unknown licenses found

Licenses found

MPL-2.0
LICENSE
Unknown
LICENSE-ERFA

Stars

Watchers

Forks

Packages

No packages published