Conceptual Introduction
Cerulion Core provides automatic serialization for message types, eliminating the need to manually write serialization code for simple structs. The serialization system supports two approaches:- Automatic Copy Type Serialization: Any
Copytype with#[repr(C)]layout is automatically serializable using raw byte conversion - Protobuf Serialization: For cross-language compatibility and schema evolution, protobuf messages are supported via the
ProtoSerializabletrait
Automatic Copy Support
Any
Copy type with #[repr(C)] automatically implements SerializableMessage. No manual serialization code needed.Protobuf Support
Optional protobuf serialization for cross-language communication and schema evolution via
ProtoSerializable trait.Relocatable Messages
Automatic handling of relocatable-wrapped messages.
from_bytes() extracts payloads transparently.Zero-Copy Local
Local communication uses zero-copy shared memory. Network communication serializes automatically.
The serialization system is designed to be transparent. You work with typed structs, and Cerulion handles the byte conversion automatically. For local communication, data is sent as raw bytes using zero-copy shared memory. For network communication, data is serialized to bytes automatically.
Key Behaviors and Guarantees
- Automatic implementation for Copy types - Any
Copytype with#[repr(C)]automatically implementsSerializableMessage - Relocatable message support -
from_bytes()automatically unwraps relocatable messages and extracts payloads - Type safety - Serialization validates type sizes and ensures memory safety
- Zero-copy local transport - Local communication uses direct memory copy, no serialization overhead
- Network serialization - Network communication automatically serializes using
#[repr(C)]layout