Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sysfs_path returning &Path, deprecate path() #21

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

Dirbaio
Copy link
Contributor

@Dirbaio Dirbaio commented Jan 5, 2024

Currently you can get a SysfsPath from DeviceInfo, but you can't really do anything
with it because it has no methods and the inner PathBuf is private.

This makes it pub.

The SysfsPath type is a bit useless from outside the crate though. Alternatvely DeviceInfo.path() could return a PathBuf, but that's a breaking change.

@kevinmehall
Copy link
Owner

How about adding a new method DeviceInfo::sysfs_path(&self) -> &std::fs::Path and deprecate path() to be removed in 0.2? path is kind of a bad name anyway, because it could be confused with the /dev/bus/usb path to the device node.

Anyone using this is probably going to reimplement the private methods on SysfsPath for reading sysfs attributes, but I think exposing those is probably beyond the scope of this library, so Path or PathBuf is probably better than having an extra type in the API.

@Dirbaio
Copy link
Contributor Author

Dirbaio commented Jan 5, 2024

@kevinmehall sounds good, done!

@kevinmehall
Copy link
Owner

Thanks!

@kevinmehall kevinmehall merged commit 54d3eee into kevinmehall:main Jan 5, 2024
3 checks passed
@kevinmehall kevinmehall changed the title Make SysfsPath contents pub. Add sysfs_path returning &Path, deprecate path() Jan 5, 2024
tuna-f1sh pushed a commit to tuna-f1sh/nusb that referenced this pull request Sep 26, 2024
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.

2 participants