File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,11 +68,10 @@ pub struct Distribution {
6868 pub description_content_type : Option < String > ,
6969}
7070
71- impl FromStr for Distribution {
72- type Err = Error ;
73-
74- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
75- let msg = mailparse:: parse_mail ( s. as_bytes ( ) ) ?;
71+ impl Distribution {
72+ /// Parse distribution metadata from metadata bytes
73+ pub fn parse ( content : & [ u8 ] ) -> Result < Self , Error > {
74+ let msg = mailparse:: parse_mail ( content) ?;
7675 let headers = msg. get_headers ( ) ;
7776 let metadata_version = headers
7877 . get_first_value ( "Metadata-Version" )
@@ -84,6 +83,14 @@ impl FromStr for Distribution {
8483 }
8584}
8685
86+ impl FromStr for Distribution {
87+ type Err = Error ;
88+
89+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
90+ Distribution :: parse ( s. as_bytes ( ) )
91+ }
92+ }
93+
8794#[ cfg( test) ]
8895mod tests {
8996 use super :: Distribution ;
You can’t perform that action at this time.
0 commit comments