You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0038]: the trait `bytes::Buf` cannot be made into an object
--> src/proto.rs:17:5
|
17 | buf: Option<Box<Buf>>,
| ^^^^^^^^^^^^^^^^^^^^^ the trait `bytes::Buf` cannot be made into an object
|
= note: method `get_u16` has generic type parameters
= note: method `get_i16` has generic type parameters
= note: method `get_u32` has generic type parameters
= note: method `get_i32` has generic type parameters
= note: method `get_u64` has generic type parameters
= note: method `get_i64` has generic type parameters
= note: method `get_uint` has generic type parameters
= note: method `get_int` has generic type parameters
= note: method `get_f32` has generic type parameters
= note: method `get_f64` has generic type parameters
While I'm not sure if boxing buf is good for performance reasons, I'd prefer that boxing be allowed for flexibility.
This can be done in in two ways:
Use different methods get_u16_le and get_u16_be
Making a wrapper type: buf.little_endian_reader().get_u16()
While slightly less convenient, I still think it's beneficial to make a trait object-safe.
This can only be done as a breaking change in 0.5 though.
The text was updated successfully, but these errors were encountered:
Currently, rust complains:
While I'm not sure if boxing buf is good for performance reasons, I'd prefer that boxing be allowed for flexibility.
This can be done in in two ways:
get_u16_le
andget_u16_be
buf.little_endian_reader().get_u16()
While slightly less convenient, I still think it's beneficial to make a trait object-safe.
This can only be done as a breaking change in 0.5 though.
The text was updated successfully, but these errors were encountered: