khora_core/scene/
serialization.rs

1// Copyright 2025 eraflo
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Defines the public API for the Goal-Oriented Adaptive Serialization system (SAA-Serialize).
16//!
17//! This module contains the core data structures that form the contract between the user
18//! and the engine's serialization capabilities. The central concept is the [`SerializationGoal`]
19//! enum, which allows developers to express their *intent* (e.g., speed, stability, readability)
20//! rather than being forced to choose a specific file format.
21
22/// Defines the developer's high-level intention for a serialization operation.
23///
24/// This enum is the core of the SAA-Serialize system's public API. Instead of
25/// specifying a format, the user specifies a goal, and the `SerializationAgent`
26/// chooses the best strategy to achieve it.
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
28pub enum SerializationGoal {
29    /// Prioritizes the fastest possible loading time.
30    /// This is the ideal choice for production game builds where loading screens
31    /// must be minimized. The resulting file may be larger or unreadable.
32    FastestLoad,
33
34    /// Prioritizes the smallest possible file size on disk.
35    /// This is useful for network transfers, content patches, or game saves
36    /// where storage space is a concern. Loading may be slower.
37    SmallestFileSize,
38
39    /// Prioritizes human-readability for debugging and version control.
40    /// The output will be a text-based format (like RON) that can be easily
41    /// inspected and diffed. This is the slowest option.
42    HumanReadableDebug,
43
44    /// Prioritizes long-term stability and forward compatibility.
45    /// The format used will be decoupled from the engine's internal memory layout,
46    /// ensuring the scene file can be loaded by future versions of Khora.
47    LongTermStability,
48
49    /// Prioritizes a flexible, structured format suitable for editor
50    /// operations, prefabs, and tool interchange.
51    EditorInterchange,
52}