This release changes the resource management strategy. Tracking lifetimes of dependent resources makes for a less-ergonomic API. That has been replaced with reference-counting. There are no known backwards-compatibility issues with this change, so existing code should not have to be updated for compatibility with reference-counting.
There are, however, some breaking changes to the API that are unrelated to the changes in resource management:
-
Context::device_from_syspath()
has been moved toDevice::from_syspath()
. Upgrading involves a search-and-replace. Anywhere you have the following code:context.device_from_syspath(path);
should be replaced with:
Device::from_syspath(&context, path);
-
Several methods on
Device
changed their return type to account for the possibility of the C library returningNULL
pointers:Device::syspath()
returnsOption<&Path>
instead of&Path
.Device::devpath()
returnsOption<&OsStr>
instead of&OsStr
.Device::subsystem()
returnsOption<&OsStr>
instead of&OsStr
.Device::sysname()
returnsOption<&OsStr>
instead of&OsStr
.
Client code will have to decide how to handle a
None
return value.
- Implemented
Clone
forContext
.
- Fixed several issues related to lifetimes.
- Handled possible
NULL
return fromudev_device_get_syspath()
,udev_device_get_devpath()
,udev_device_get_subsystem()
, andudev_device_get_sysname()
. - Reduced memory footprint of several types to a single pointer.
- Reduced unnecessary memory allocations when iterating devices and setting up a monitor.
- Replaced explicit lifetimes with reference counting.
- Moved
Context::device_from_syspath()
toDevice::from_syspath()
. - Changed return type of
Device::syspath()
,Device::devpath()
,Device::subsystem()
, andDevice::sysname()
toOption<...>
.
- Added
Device::parent()
.
- Replaced
c_int
error code withstd::io::ErrorKind
. - Minimum supported version of Rust is now 1.4.0.
- Upgraded libc dependency to v0.2.
- Added
Monitor
. - Wrote documentation.
- Bumped
libudev-sys
dependency to v0.1.1, which allowslibudev
to compile on 1.0.0-beta and presumably the imminent 1.0.0 release.
- Removed dependencies on unstable features:
#![feature(libc)]
: replaced withlibc
crate#1[feature(std_misc)]
: replacedAsOsStr
withAsRef<OsStr>
#![feature(unsafe_destructor)]
: stabilized
Initial release