rust-spice 0.3.5

WOW! The complete NASA/NAIF Spice toolkit is actually usable on Rust.
docs.rs failed to build rust-spice-0.3.5
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: rust-spice-0.7.8

rust-spice

logo image

crate badge doc badge license badge pre-commit badge

WOW! The complete NASA/NAIF Spice toolkit is actually usable on Rust


Rational | Disclaimer | Installation | License


Rational

Other crates already exist for wrapping C spice: spice-sys and cspice-sys. The motivation behind the creation of rust-spice was 1) the need to access the complete spice API from Rust and 2) the need to have a nice Rust layer to code naturally.

Complete API

spice-sys does not use bindgen to wrap which is error-prone and does not provide a complete API. The description of spice-sys says:

Currently, it provides only the most common API calls as outlined here.

This boosted me to build a complete C spice wrapper.

cspice-sys is build with bindgen but the cspice code is collected in a strange way, the original architecture of cspice is not respected, plus the repository is missing somehow. I cannot ensure the full- API is available with this crate.

Rust interface

These crates are bare wrappers and do not provide a Rust user-friendly interface, which constrains the user to use unsafe and FFI types conversion which is simply a pain to use.

I wanted to use spice from Rust without feeling it being a C wrapper, for quicker and simplier development and usage in my crates.

I could have started by forking one these two crates or using them in dependency, but both of them did not feel sane to use. I decided to also provide my own wrapper, which can be used during the process of the creation of the Rust layer.

S/O

Many thanks to the author of the crate spice-sys for the idea of the wget script to avoid crate upload, I included your script copyrighted under your MIT license and added some modifications that I listed carefully.

Disclaimer

This crate is my first exercice to write a wrapper, all kind advices are warmly welcomed.

The Rust layer is being built in real time as I face the need of it. Raise an issue with the need of a function/struct and we will work on it immediately. Any time a function is not wrapped inside safe code, you can still use the unsafe code to call it.

Apparently the documentation is not building online, though I spent a lot of time writting it. On my pc it is building just nice. By reading docs.rs output, the header cspice/include/SpiceUser.h is not in the include PATH obviously. Locally it works because in my build.rs I use .clang_arg() on the the bindgen:Builder to tell Rust where to find the damn header. And it should work online also, I guess. Any help is appreciated to solve this issue!! I can send you the offline documentation in the meantime if you want.

Installation

Add the dependency rust-spice to your Cargo.toml:

...
[dependencies]
rust-spice = "0.3.5"

License

Licensed under the Apache License, Version 2.0.