open_dis_rust/common/
vector3_double.rs1use bytes::{Buf, BufMut, BytesMut};
8
9#[derive(Copy, Clone, Debug, Default)]
10pub struct Vector3Double {
12 pub x: f64,
14 pub y: f64,
16 pub z: f64,
18}
19
20impl Vector3Double {
21 #[must_use]
22 pub fn new(x: f64, y: f64, z: f64) -> Self {
23 Vector3Double { x, y, z }
24 }
25
26 pub fn serialize(&self, buf: &mut BytesMut) {
27 buf.put_f64(self.x);
28 buf.put_f64(self.y);
29 buf.put_f64(self.z);
30 }
31
32 pub fn decode(buf: &mut BytesMut) -> Vector3Double {
33 Vector3Double {
34 x: buf.get_f64(),
35 y: buf.get_f64(),
36 z: buf.get_f64(),
37 }
38 }
39}