Skip to content

Rust docs examples - #55

Merged
simondsmart merged 22 commits into
developfrom
rust-docs-examples
Oct 15, 2026
Merged

simondsmart merged 22 commits into
developfrom
rust-docs-examples

Conversation

@Choochmeque

@Choochmeque Choochmeque commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Rust documentation and examples

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/odc/pull-requests/PR-55

@codecov-commenter

codecov-commenter commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.03%. Comparing base (c94e0fb) to head (d76e00e).
⚠️ Report is 20 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #55      +/-   ##
===========================================
+ Coverage    87.00%   87.03%   +0.02%     
===========================================
  Files          189      189              
  Lines        15125    15219      +94     
  Branches      1370     1370              
===========================================
+ Hits         13160    13246      +86     
- Misses        1965     1973       +8     

☔ 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.

@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.

Generally good. You need to include the stride behaviour in the custom encoders/decoders.

I also think that the Span functionality is the perfect place for a rust enum. Consider that the span is essentially a map<column-name, enum<integers, strings, floats>>

uint64_t offset() const;
uint64_t length() const;
bool equals(const SpanWrapper& other) const;
rust::Vec<int64_t> integer_values(rust::Str column) const;

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.

This misses something of the underlying functionality of Span - and that can be seen in the documentation example.

This is important in a context where you may not know what the types you are going to have - or indeed, which columns are going to be there in the first place.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 652593c


.. code-block:: rust

// Decode all columns into a Polars DataFrame

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.

This Polars stuff needs a bit more upfront commentary. Because this is different to the model for the C and Fortran data (and is more similar to the python one).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 1a8b20e


.. note::

Rust interface does not support data encoding from a column-major layout. In this case, encode from a Polars ``DataFrame`` or from a :ref:`custom memory layout <encoder-custom-layout>` instead.

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.

Is there a particualr reason why not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bc2daa2

// set up the data here...

let columns = [
RawColumn {

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 support controlling the data stride?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bc2daa2


let options = WriteOptions::default();

// Or encode into an open eckit DataHandle

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 want to imagine writing to a more general writable rust object (imagine a network socket, or something else). Can we show the eckit behaviour of capturing a more general rust writable object?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in d76e00e, requires ecmwf/eckit#375 (DataHandle::from_writer)

@simondsmart
simondsmart merged commit e766a08 into develop Oct 15, 2026
195 of 218 checks passed
@Choochmeque
Choochmeque deleted the rust-docs-examples branch October 16, 2026 15:43
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