Skip to content

Rust bindings (eckit-sys crate)#289

Open
Choochmeque wants to merge 25 commits into
developfrom
rust-bindings
Open

Rust bindings (eckit-sys crate)#289
Choochmeque wants to merge 25 commits into
developfrom
rust-bindings

Conversation

@Choochmeque

@Choochmeque Choochmeque commented Apr 30, 2026

Copy link
Copy Markdown

Description

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/eckit/pull-requests/PR-289

@codecov-commenter

codecov-commenter commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.41%. Comparing base (901e752) to head (0e87182).

Files with missing lines Patch % Lines
src/eckit/io/EasyCURL.cc 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #289      +/-   ##
===========================================
- Coverage    66.41%   66.41%   -0.01%     
===========================================
  Files         1128     1128              
  Lines        57925    57926       +1     
  Branches      4413     4413              
===========================================
  Hits         38470    38470              
- Misses       19455    19456       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Choochmeque Choochmeque marked this pull request as ready for review June 11, 2026 00:13

@simondsmart simondsmart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments/changes/questions.

Comment thread rust/Cargo.toml Outdated
eckit-sys = { path = "crates/eckit-sys" }

# Build tools
bindman = { git = "ssh://git@github.com/ecmwf/bindman.git" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need/want to pin the version of these?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 51584a5

Comment thread rust/crates/eckit-sys/README.md Outdated
This crate provides raw FFI bindings using [cxx](https://cxx.rs/). For a safe,
ergonomic API, use the higher-level `eckit` crate (forthcoming).

## Features

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check this please, as there is a lot of functionality listed below which is not made available in the rust bindings.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not Rust API features, they're a 1:1 mapping to eckit's CMake ENABLE_* flags that gate which optional C++ components get built into the vendored library.

Fixed in 0ed608e

// ==================== DataHandle ====================

/// Wraps `eckit::DataHandle*` for Rust FFI. Takes ownership.
class DataHandleWrapper {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing all of these classes in this one header, do we want to split this into multiple topic related header files, to make this more digestable?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 78a5e90

};

// Factory
std::unique_ptr<ReaderWrapper> new_reader(DataHandleWrapper& handle);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be free functions, or would they not be cleaner as static functions in the DataHandleWrapper class?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cd4de73

class StreamWrapper {
protected:

eckit::Stream* stream_ = nullptr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a raw pointer here? If it is owning, then it should be unique_ptr. If it is not, then it should hold the stream by reference.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f74decb

RustMain::RustMain(int argc, char** argv) : Main(argc, argv) {}

eckit::LogTarget* RustMain::createInfoLogTarget() const {
return new RustLogTarget(LogLevel::Info, "eckit");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that "eckit" is the right name for these targets. They are application level targets, and should probably take their name from the calling code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e3d7d9d

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fc54544 and 6428f27

if (!eckit::Main::ready()) {
static const char* argv[] = {"eckit-rs", nullptr};
static auto* main = new RustMain(1, const_cast<char**>(argv));
(void)main;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this (void) main for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f1490c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants