use bytes::{BytesMut, BufMut, Buf};
#[derive(Copy, Clone, Debug, Default)]
pub struct VelocityVectorRecord {
pub first_vector_component_field: f32,
pub second_vector_component_field: f32,
pub third_vector_component_field: f32
}
impl VelocityVectorRecord {
pub fn new(x: f32, y: f32, z: f32) -> Self {
VelocityVectorRecord {
first_vector_component_field: x,
second_vector_component_field: y,
third_vector_component_field: z
}
}
pub fn serialize(&self, buf: &mut BytesMut) {
buf.put_f32(self.first_vector_component_field);
buf.put_f32(self.second_vector_component_field);
buf.put_f32(self.third_vector_component_field);
}
pub fn decode(buf: &mut BytesMut) -> VelocityVectorRecord {
VelocityVectorRecord {
first_vector_component_field: buf.get_f32(),
second_vector_component_field: buf.get_f32(),
third_vector_component_field: buf.get_f32()
}
}
}