@@ -56,25 +56,11 @@ fn deserialize() -> RustPrinter {
5656}
5757
5858fn derive_line ( ) -> RustPrinter {
59- line (
60- unit ( )
61- + "#[derive(Debug, Clone, PartialEq, "
62- + serialize ( )
63- + ", "
64- + deserialize ( )
65- + ")]" ,
66- )
59+ line ( unit ( ) + "#[derive(Debug, Clone, PartialEq, " + serialize ( ) + ", " + deserialize ( ) + ")]" )
6760}
6861
6962fn derive_line_simple ( ) -> RustPrinter {
70- line (
71- unit ( )
72- + "#[derive(Debug, Clone, PartialEq, "
73- + serialize ( )
74- + ", "
75- + deserialize ( )
76- + ")]" ,
77- )
63+ line ( unit ( ) + "#[derive(Debug, Clone, PartialEq, " + serialize ( ) + ", " + deserialize ( ) + ")]" )
7864}
7965
8066fn rename_line ( to : & str ) -> RustPrinter {
@@ -356,7 +342,20 @@ pub fn multipart_field_module() -> Result<Module> {
356342 + line ( "fn to_multipart_field(&self) -> String;" )
357343 + line ( "fn mime_type(&self) -> &'static str;" ) ,
358344 )
359- + line ( unit ( ) + "}" ) ;
345+ + line ( unit ( ) + "}" )
346+ + NewLine
347+ + line ( unit ( ) + "impl<T: Display> MultipartField for T {" )
348+ + indented (
349+ unit ( )
350+ + line ( "fn to_multipart_field(&self) -> String {" )
351+ + indented ( line ( "self.to_string()" ) )
352+ + line ( "}" )
353+ + NewLine
354+ + line ( unit ( ) + "fn mime_type(&self) -> &'static str {" )
355+ + indented ( line ( r#""""text/plain; charset=utf-8""""# ) )
356+ + line ( unit ( ) + "}" ) ,
357+ )
358+ + line ( "}" ) ;
360359
361360 Ok ( Module {
362361 def : ModuleDef {
@@ -465,22 +464,6 @@ pub fn model_gen(
465464 ) +
466465 line ( "}" )
467466 ) +
468- line ( "}" ) +
469- NewLine +
470- line ( unit ( ) + "impl " + rust_name ( "crate::model" , "MultipartField" ) + " for " + & name + "{" ) +
471- indented (
472- line ( unit ( ) + "fn to_multipart_field(&self) -> String {" ) +
473- indented (
474- line ( "self.to_string()" )
475- ) +
476- line ( "}" ) +
477- NewLine +
478- line ( unit ( ) + "fn mime_type(&self) -> &'static str {" ) +
479- indented (
480- line ( r#""text/plain; charset=utf-8""# )
481- ) +
482- line ( "}" )
483- ) +
484467 line ( "}" ) ;
485468
486469 Ok ( code)
0 commit comments