1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Borrowed projections generated for redacted structured serialization.
use crate::RedactionPolicy;
/// Borrows the field projection used for redacted structured serialization.
///
/// The associated projection deliberately has no `Serialize` bound. This lets
/// a `Redact` implementation exist for text-only values; Serde reports a
/// trait-bound error only when callers request structured serialization.
pub trait RedactSerializeSource {
/// A borrowed projection of this value's fields.
///
/// # Type Parameters
///
/// - `'a`: Actual borrow of the source retained by the projection.
type RedactedFields<'a>
where
Self: 'a;
/// Borrows the fields under `policy` without cloning the source value.
///
/// # Type Parameters
///
/// - `'value`: Borrow of the source retained by the returned projection.
///
/// # Parameters
///
/// - `policy`: Snapshot applied by the enclosing serialization scope.
///
/// # Returns
///
/// A lazy projection borrowing the source without visiting its fields.
fn redacted_fields<'value>(&'value self, policy: &RedactionPolicy) -> Self::RedactedFields<'value>;
}