@@ -38,13 +38,14 @@ fn dequote(value: &str) -> Option<String> {
3838 Some ( result)
3939}
4040
41- pub ( crate ) struct OsReleaseInfo < ' a > {
41+ #[ derive( Debug ) ]
42+ pub struct OsReleaseInfo < ' a > {
4243 map : HashMap < & ' a str , & ' a str > ,
4344}
4445
4546impl < ' a > OsReleaseInfo < ' a > {
4647 /// Parses an /etc/os-release file
47- pub ( crate ) fn parse ( content : & ' a str ) -> Self {
48+ pub fn parse ( content : & ' a str ) -> Self {
4849 let map = HashMap :: from_iter (
4950 content
5051 . lines ( )
@@ -56,25 +57,25 @@ impl<'a> OsReleaseInfo<'a> {
5657
5758 /// Looks up a key (like "PRETTY_NAME") in the os-release file and returns the properly
5859 /// dequoted and unescaped value, if one exists.
59- pub ( crate ) fn get_value ( & self , keys : & [ & str ] ) -> Option < String > {
60+ pub fn get_value ( & self , keys : & [ & str ] ) -> Option < String > {
6061 keys. iter ( )
6162 . find_map ( |key| self . map . get ( key) . and_then ( |v| dequote ( v) ) )
6263 }
6364
6465 /// Returns the value of the PRETTY_NAME, NAME, or ID field, whichever is found first.
65- pub ( crate ) fn get_pretty_name ( & self ) -> Option < String > {
66+ pub fn get_pretty_name ( & self ) -> Option < String > {
6667 self . get_value ( & [ "PRETTY_NAME" , "NAME" , "ID" ] )
6768 }
6869
6970 /// Returns the value of the VERSION_ID or VERSION field, whichever is found first.
70- pub ( crate ) fn get_version ( & self ) -> Option < String > {
71+ pub fn get_version ( & self ) -> Option < String > {
7172 self . get_value ( & [ "VERSION_ID" , "VERSION" ] )
7273 }
7374
7475 /// Combines get_pretty_name() with get_version() as specified in the Boot Loader
7576 /// Specification to produce a boot label. This will return None if we can't find a name, but
7677 /// failing to find a version isn't fatal.
77- pub ( crate ) fn get_boot_label ( & self ) -> Option < String > {
78+ pub fn get_boot_label ( & self ) -> Option < String > {
7879 let mut result = self . get_pretty_name ( ) ?;
7980 if let Some ( version) = self . get_version ( ) {
8081 result. push_str ( & format ! ( " {version}" ) ) ;
0 commit comments