dubbo_rs_serialization/lib.rs
1pub use dubbo_rs_common;
2
3use anyhow::Result;
4
5pub trait Serialization: Send + Sync {
6 fn content_type(&self) -> &'static str;
7
8 /// Serialize raw bytes into wire-format payload.
9 ///
10 /// # Errors
11 ///
12 /// Returns an error if the serialization fails (e.g., invalid input data).
13 fn serialize(&self, data: &[u8]) -> Result<Vec<u8>>;
14
15 /// Deserialize wire-format payload back to raw bytes.
16 ///
17 /// # Errors
18 ///
19 /// Returns an error if the deserialization fails (e.g., malformed data).
20 fn deserialize(&self, data: &[u8]) -> Result<Vec<u8>>;
21}