Skip to content

Conversation

@miguelraz
Copy link
Contributor

@miguelraz miguelraz commented Jan 3, 2025

Goal:

Write a fleshed out exercise that

  • pulls in a header only C++ library
  • calls its C++ functionality from Rust using autocxx with some C++'isms like exceptions and std::string, etc.
  • requires users to crunch a bit of the data using Rust (and comparing to polars)
  • Talk about pitfalls of generating the bindings, build.rs, gcc vs clang include flags, cleanup procedures for non-POD stuff

Status:

Reading the CSV with bindings generated via autocxx is painful and so is navigating said errors. Invoking overloaded constructors for rapidcsv::Document is quite cumbersome.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 18, 2025

Deploying ferrous-systems-rust-exercises with  Cloudflare Pages  Cloudflare Pages

Latest commit: 91b6631
Status: ✅  Deploy successful!
Preview URL: https://02208642.ferrous-systems-rust-exercises.pages.dev
Branch Preview URL: https://rapidcsv.ferrous-systems-rust-exercises.pages.dev

View logs

@miguelraz miguelraz marked this pull request as ready for review March 6, 2025 00:16
Comment on lines 19 to 40
1. Use `autocxx` to develop bindings to a `rapidcsv.h` and print out the dates in `example.csv`, from within Rust as well as the `RowCount`.

You should get:

```console
6
2017-02-24
2017-02-23
2017-02-22
2017-02-21
2017-02-17
```

Because there are 5 rows of data and a header row.

2. Use `autocxx` to read `weather.csv` and report the average temperature in June, which should be approximately

```console
1.20
```

A full solution is available at `rust-exercises/exercises-solutions/cpp-interop`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should expand the tasks section? Give a list of steps to follow within each point to give people a plan to follow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've expanded both sections now. Care to review for phrasing please?

@miguelraz
Copy link
Contributor Author

@listochkin This revision should be good enough for a merge or close enough so that you can get it over the finish line if you add small tweaks.

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.

4 participants