diwic / dbus-rs

D-Bus binding for the Rust language
Other
585 stars 131 forks source link

Could `from_slice_unchecked` be made `const` for the string types? #474

Closed ModProg closed 2 months ago

ModProg commented 2 months ago

This would allow putting them in constants.

The only issue I foresee would be the plan to eventually move away from zero terminated strings, as mentioned here: https://github.com/diwic/dbus-rs/blob/d6f530592115262e7fe5523efb55f066a70c25a2/dbus/src/strings.rs#L64-L72

Code change required for this would only be a single line, so this is more about the question of whether this should be implemented. As I'd be happy to contribute the needed PR.