@@ -600,14 +600,16 @@ impl ToField for Action {
600
600
}
601
601
}
602
602
603
- impl ToString for Action {
604
- fn to_string ( & self ) -> String {
605
- match self {
606
- Action :: Buy => String :: from ( "BUY" ) ,
607
- Action :: Sell => String :: from ( "SELL" ) ,
608
- Action :: SellShort => String :: from ( "SSHORT" ) ,
609
- Action :: SellLong => String :: from ( "SLONG" ) ,
610
- }
603
+ impl std:: fmt:: Display for Action {
604
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
605
+ let text = match self {
606
+ Action :: Buy => "BUY" ,
607
+ Action :: Sell => "SELL" ,
608
+ Action :: SellShort => "SSHORT" ,
609
+ Action :: SellLong => "SLONG" ,
610
+ } ;
611
+
612
+ write ! ( f, "{text}" )
611
613
}
612
614
}
613
615
@@ -657,19 +659,21 @@ impl ToField for Option<Rule80A> {
657
659
}
658
660
}
659
661
660
- impl ToString for Rule80A {
661
- fn to_string ( & self ) -> String {
662
- match self {
663
- Rule80A :: Individual => String :: from ( 'I' ) ,
664
- Rule80A :: Agency => String :: from ( 'A' ) ,
665
- Rule80A :: AgentOtherMember => String :: from ( 'W' ) ,
666
- Rule80A :: IndividualPTIA => String :: from ( 'J' ) ,
667
- Rule80A :: AgencyPTIA => String :: from ( 'U' ) ,
668
- Rule80A :: AgentOtherMemberPTIA => String :: from ( 'M' ) ,
669
- Rule80A :: IndividualPT => String :: from ( 'K' ) ,
670
- Rule80A :: AgencyPT => String :: from ( 'Y' ) ,
671
- Rule80A :: AgentOtherMemberPT => String :: from ( 'N' ) ,
672
- }
662
+ impl std:: fmt:: Display for Rule80A {
663
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
664
+ let text = match self {
665
+ Rule80A :: Individual => "I" ,
666
+ Rule80A :: Agency => "A" ,
667
+ Rule80A :: AgentOtherMember => "W" ,
668
+ Rule80A :: IndividualPTIA => "J" ,
669
+ Rule80A :: AgencyPTIA => "U" ,
670
+ Rule80A :: AgentOtherMemberPTIA => "M" ,
671
+ Rule80A :: IndividualPT => "K" ,
672
+ Rule80A :: AgencyPT => "Y" ,
673
+ Rule80A :: AgentOtherMemberPT => "N" ,
674
+ } ;
675
+
676
+ write ! ( f, "{text}" )
673
677
}
674
678
}
675
679
@@ -816,12 +820,14 @@ impl ToField for Option<OrderOpenClose> {
816
820
}
817
821
}
818
822
819
- impl ToString for OrderOpenClose {
820
- fn to_string ( & self ) -> String {
821
- match self {
822
- OrderOpenClose :: Open => String :: from ( "O" ) ,
823
- OrderOpenClose :: Close => String :: from ( "C" ) ,
824
- }
823
+ impl std:: fmt:: Display for OrderOpenClose {
824
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
825
+ let text = match self {
826
+ OrderOpenClose :: Open => "O" ,
827
+ OrderOpenClose :: Close => "C" ,
828
+ } ;
829
+
830
+ write ! ( f, "{text}" )
825
831
}
826
832
}
827
833
0 commit comments