pub trait Serializer: Send + Sync {
// Required methods
fn serialize<T: Serialize>(&self, value: &T) -> RustvelloResult<String>;
fn deserialize<T: DeserializeOwned>(&self, data: &str) -> RustvelloResult<T>;
}Expand description
Serializer interface for converting values to/from strings.
Provides a uniform interface for the system, enabling custom serialization strategies (e.g., for Python interop via PyO3).
In Rust, the default SerdeSerializer uses serde_json directly.
Python backends can implement this trait with pickle or custom codecs.
Required Methods§
Sourcefn serialize<T: Serialize>(&self, value: &T) -> RustvelloResult<String>
fn serialize<T: Serialize>(&self, value: &T) -> RustvelloResult<String>
Serialize a value to its string representation.
Sourcefn deserialize<T: DeserializeOwned>(&self, data: &str) -> RustvelloResult<T>
fn deserialize<T: DeserializeOwned>(&self, data: &str) -> RustvelloResult<T>
Deserialize a string into the target type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.