Skip to content

Commit

Permalink
Add sysfs_path returning &Path, deprecate path().
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Jan 5, 2024
1 parent 38db907 commit 6458859
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ pub struct DeviceInfo {

impl DeviceInfo {
/// *(Linux-only)* Sysfs path for the device.
#[doc(hidden)]
#[deprecated = "use `sysfs_path()` instead"]
#[cfg(target_os = "linux")]
pub fn path(&self) -> &SysfsPath {
&self.path
}

/// *(Linux-only)* Sysfs path for the device.
#[cfg(target_os = "linux")]
pub fn sysfs_path(&self) -> &std::path::Path {
&self.path.0
}

/// *(Windows-only)* Instance ID path of this device
#[cfg(target_os = "windows")]
pub fn instance_id(&self) -> &OsStr {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux_usbfs/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::Error;
use crate::Speed;

#[derive(Debug, Clone)]
pub struct SysfsPath(PathBuf);
pub struct SysfsPath(pub(crate) PathBuf);

impl SysfsPath {
pub(crate) fn read_attr<T: FromStr>(&self, attr: &str) -> Result<T, io::Error>
Expand Down

0 comments on commit 6458859

Please sign in to comment.