ue_types/lib.rs
1//! # UE Types Library
2//!
3//! A Rust library providing common Unreal Engine data types for game servers.
4//!
5//! This crate provides Rust equivalents of common Unreal Engine types like:
6//! - `Vector`, `Vector2D`, `Vector4`
7//! - `Rotator` and `Quaternion`
8//! - `Transform`
9//! - `Color` and `LinearColor`
10//! - `BoundingBox` and other geometric types
11//!
12//! All types support:
13//! - Display formatting
14//! - JSON serialization/deserialization with serde
15//! - Binary serialization/deserialization with bincode
16//! - Built on top of the high-performance `glam` math library
17
18pub mod vector;
19pub mod rotator;
20pub mod transform;
21pub mod color;
22pub mod bounds;
23
24// Re-export glam types for convenience
25pub use glam::{Mat3, Mat4, Quat, Vec2, Vec3, Vec4};
26
27// Re-export our custom types
28pub use vector::*;
29pub use rotator::*;
30pub use transform::*;
31pub use color::*;
32pub use bounds::*;
33
34/// Trait for binary serialization/deserialization
35pub trait BinarySerializable: Sized {
36 /// Serialize to binary format
37 fn to_binary(&self) -> Result<Vec<u8>, bincode::Error>
38 where
39 Self: serde::Serialize,
40 {
41 bincode::serialize(self)
42 }
43
44 /// Deserialize from binary format
45 fn from_binary(data: &[u8]) -> Result<Self, bincode::Error>
46 where
47 Self: serde::de::DeserializeOwned,
48 {
49 bincode::deserialize(data)
50 }
51}