qubit_redact/domain/internal/redact_serialize.rs
1// =============================================================================
2// Copyright (c) 2025 - 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Generated structured serialization capability.
9
10use serde::Serializer;
11
12use crate::RedactionPolicy;
13
14/// Legacy structured-redaction hook for manually implemented container
15/// adapters. Derived domain values use the projection capability instead.
16pub trait RedactSerialize {
17 /// Serializes this value through a caller-supplied policy.
18 ///
19 /// # Errors
20 ///
21 /// Propagates admission or downstream serialization failures.
22 ///
23 /// # Type Parameters
24 ///
25 /// - `S`: Downstream serializer defining the result and error types.
26 ///
27 /// # Parameters
28 ///
29 /// - `serializer`: Destination receiving the policy-selected
30 /// representation.
31 /// - `policy`: Immutable policy supplied by the enclosing scoped adapter.
32 ///
33 /// # Returns
34 ///
35 /// The downstream result after the admitted representation is serialized.
36 fn serialize_redacted<S>(&self, serializer: S, policy: &RedactionPolicy) -> Result<S::Ok, S::Error>
37 where
38 S: Serializer;
39}