stanislav-tkach / os_info

Rust library to detect the operating system type
MIT License
175 stars 52 forks source link

Get rid of `Version` type complications #280

Open stanislav-tkach opened 3 years ago

stanislav-tkach commented 3 years ago

Perhaps representing a version with the enum was a mistake. Now I think that Option<String> is enough. I'm not sure if it is worth one more breaking change (4.0?), though.

ydirson commented 1 year ago

It is definitely useful to be able to parse a version to extract major/minor (maybe only to feed to legacy APIs). But different OS have different conventions (think FreeBSD's 13.2-RELEASE).

The constraint would be, how we can go on providing an API to easily extract major/minor if any. Maybe a Version::get_major_minor() method, with a match statement on os type to delegate to various version parsers?

stanislav-tkach commented 1 year ago

@ydirson I really like your idea. Perhaps it would be the best middle ground: to store version as a string and have a bunch of methods to (try to) extract more specific information.