File tree 2 files changed +3
-8
lines changed
2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -154,15 +154,10 @@ where
154
154
}
155
155
156
156
pub trait LogMessage : Serialize {
157
+ //TODO AAZ: Measure this an remove if rust already optimize the code without it.
157
158
/// Indicates that parsing this struct to text can error.
158
159
const CAN_ERROR : bool ;
159
160
160
- //TODO AAZ: Measure this an remove if rust already optimize the code without it.
161
- #[ inline( always) ]
162
- fn can_error ( & self ) -> bool {
163
- <Self as LogMessage >:: CAN_ERROR
164
- }
165
-
166
161
/// Serializes a message directly into a Writer
167
162
/// returns the size of the serialized message
168
163
fn to_writer < W : Write > ( & self , writer : & mut W ) -> Result < usize , std:: io:: Error > ;
Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ impl ParseErrorReslover {
44
44
/// Get the text message of [`LogMessage`], resolving parse text errors if possible,
45
45
/// TODO: Otherwise it should save the error to the faulty messages store, which need to be
46
46
/// implemented as well :)
47
- pub fn get_log_text ( item : impl LogMessage , err_resolver : & mut ParseErrorReslover ) -> String {
47
+ pub fn get_log_text < T : LogMessage > ( item : T , err_resolver : & mut ParseErrorReslover ) -> String {
48
48
let text_res = item. to_text ( ) ;
49
- if item . can_error ( ) {
49
+ if T :: CAN_ERROR {
50
50
let mut msg = text_res. msg ;
51
51
if let Some ( err_info) = text_res. error {
52
52
match err_resolver. resolve_err ( & err_info) {
You can’t perform that action at this time.
0 commit comments