pub trait Dump: Serialize {
// Provided methods
fn serialize_dump<S: Serializer>(
&self,
serializer: S,
opts: &DumpOptions,
) -> Result<S::Ok, S::Error> { ... }
fn dump(&self, opts: &DumpOptions) -> Result<Value, DumpError> { ... }
}Expand description
Output serialization with DumpOptions (Pydantic model_dump).
The default serializes with Serde and post-processes the result, so a
hand-written type opts in with impl Dump for T {}. #[derive(Schema)]
implements it for models: computed fields, field/model serializers,
exclude_defaults, and recursion into nested models. Containers delegate
to their elements so nested models keep their computed fields.
Provided Methods§
Sourcefn serialize_dump<S: Serializer>(
&self,
serializer: S,
opts: &DumpOptions,
) -> Result<S::Ok, S::Error>
fn serialize_dump<S: Serializer>( &self, serializer: S, opts: &DumpOptions, ) -> Result<S::Ok, S::Error>
Serialize directly when supported, preserving dump semantics.
Args: serializer: Destination serializer. opts: Field selection and exclusion policy.
Returns: Serialized output, or a serialization error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".