whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
146 stars 29 forks source link

Add XDG_STATE_HOME support #33

Closed piegamesde closed 3 years ago

piegamesde commented 3 years ago

Not released yet, but it's already part of the spec: $XDG_STATE_HOME.

I added support for it in this crate by copy-pasting and following existing patterns as much as possible. As it's not officially released yet, maybe it should be hidden behind a feature flag?

whitequark commented 3 years ago

I added support for it in this crate by copy-pasting and following existing patterns as much as possible.

Code looks pretty much perfect.

As it's not officially released yet, maybe it should be hidden behind a feature flag?

I'm honestly not sure. Is it possible to emit a warning when someone uses a function in your crate?

piegamesde commented 3 years ago

Code looks pretty much perfect.

Awww, thank you 🥰

Is it possible to emit a warning when someone uses a function in your crate?

Quick Google says no. There is an #[unstable()] attribute, but it looks like it's meant to be used by std / rustc internally. I've seen people do clever hacks around #[must_use] and #[deprecated] to generated custom compile warnings.

I've seen crates (namely async_std) guard their unstable code behind a feature called unstable. The docs show those methods, but with a shiny blue badge that warn users.


On the other hand, I don't see much harm in merging this before the official release. Given the recent development pace of the XDG basedir specification, I a) don't think there will be any change to this part between now and the release and b) don't expect a new release anytime soon (the official web site is still from 2010).