Skip to content

Completely overhaul the API to use PathBuf instead of Strings - #13

Open
maspe36 wants to merge 4 commits into
mainfrom
sam/pathbuf_api
Open

Completely overhaul the API to use PathBuf instead of Strings#13
maspe36 wants to merge 4 commits into
mainfrom
sam/pathbuf_api

Conversation

@maspe36

@maspe36 maspe36 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #11

Pretty much every usage of ament_rs I could find almost immediately converts the results from the library into a PathBuf for further path manipulations [1] [2] [3]. So this inspired me to give this crate a face lift and overhaul the API to use PathBufs directly.

This should have all the functionality of the old implementation except for the has_* functions. I didn't find any usages of them and its somewhat redundant when you can do a find and just check that the optional isn't empty.

i.e.

ament_rs::find_package("rcl_interfaces")?.is_some()

Some other items to note

  • This overhaul includes tests
  • I managed to drop all dependencies except for std (outside of tests)

Comment thread Cargo.toml
edition = "2018"
description = "This crate is a client for ament which is a system for cataloging and referencing resources distributed by software packages used by ROS2."
description = "Utilities for querying the ament resource index used by ROS 2 packages."
license = "ISC"

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.

We should probably look to update this license to Apache 2.0 like the rest of the ros2_rust crates
https://github.com/ros2-rust/ros2_rust/blob/main/LICENSE

@azerupi azerupi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I can't really speak to the removed nix files, I don't know anything about nix. But the code changes look good 👍

@maspe36

maspe36 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

I can't really speak to the removed nix files, I don't know anything about nix. But the code changes look good 👍

Oh yeah, thanks for reminding me about this. I also decided to remove the devenv files (https://devenv.sh/)

I'm not too familiar with this but I figured this is a simple rust crate and it was essentially rewritten so whatever configuration that was there is likely no longer valid.

Comment thread Cargo.toml
name = "ament_rs"
version = "0.3.0"
authors = ["Gérald Lelong <gerald.lelong@easymov.fr>"]
authors = ["Gérald Lelong <gerald.lelong@easymov.fr>", "Sam Privett <sam@privett.dev>"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd keep Gérald as the original author, but add yourself as a maintainer.

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.

Change the API to use Path/PathBuf

3 participants