@@ -246,24 +246,26 @@ impl DifferenceDisplay for F32Differ {
246246 }
247247}
248248
249- /// Factory function to create appropriate differ based on output type
250- pub fn create_differ ( output_type : OutputType ) -> Box < dyn OutputDiffer + Send + Sync > {
251- match output_type {
252- OutputType :: Raw => Box :: new ( RawDiffer ) ,
253- OutputType :: F32 => Box :: new ( F32Differ ) ,
254- OutputType :: F64 => todo ! ( "F64Differ not implemented yet" ) ,
255- OutputType :: U32 => todo ! ( "U32Differ not implemented yet" ) ,
256- OutputType :: I32 => todo ! ( "I32Differ not implemented yet" ) ,
249+ impl From < OutputType > for Box < dyn OutputDiffer + Send + Sync > {
250+ fn from ( output_type : OutputType ) -> Self {
251+ match output_type {
252+ OutputType :: Raw => Box :: new ( RawDiffer ) ,
253+ OutputType :: F32 => Box :: new ( F32Differ ) ,
254+ OutputType :: F64 => todo ! ( "F64Differ not implemented yet" ) ,
255+ OutputType :: U32 => todo ! ( "U32Differ not implemented yet" ) ,
256+ OutputType :: I32 => todo ! ( "I32Differ not implemented yet" ) ,
257+ }
257258 }
258259}
259260
260- /// Factory function to create appropriate display based on output type
261- pub fn create_display ( output_type : OutputType ) -> Box < dyn DifferenceDisplay + Send + Sync > {
262- match output_type {
263- OutputType :: Raw => Box :: new ( RawDiffer ) ,
264- OutputType :: F32 => Box :: new ( F32Differ ) ,
265- OutputType :: F64 => todo ! ( "F64Display not implemented yet" ) ,
266- OutputType :: U32 => todo ! ( "U32Display not implemented yet" ) ,
267- OutputType :: I32 => todo ! ( "I32Display not implemented yet" ) ,
261+ impl From < OutputType > for Box < dyn DifferenceDisplay + Send + Sync > {
262+ fn from ( output_type : OutputType ) -> Self {
263+ match output_type {
264+ OutputType :: Raw => Box :: new ( RawDiffer ) ,
265+ OutputType :: F32 => Box :: new ( F32Differ ) ,
266+ OutputType :: F64 => todo ! ( "F64Display not implemented yet" ) ,
267+ OutputType :: U32 => todo ! ( "U32Display not implemented yet" ) ,
268+ OutputType :: I32 => todo ! ( "I32Display not implemented yet" ) ,
269+ }
268270 }
269271}
0 commit comments