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
42
43
44
45
46
47
48
49
// =============================================================================
// Copyright (c) 2025 - 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Adapter from typed text validators to the erased validation boundary.
use Arc;
use PreparedValidator;
use TextValidatorAdapter;
use crateValidator;
use crateViolationDraft;
/// Prepares a text validator using a domain-error mapper.
///
/// The returned adapter rejects non-text erased inputs and converts each domain
/// error with `map_error`; callers should ensure the mapper does not retain raw
/// input in the resulting draft.
///
/// # Type Parameters
///
/// - `V`: Validator of borrowed text with unit context.
/// - `M`: Mapper from the validator error to a safe violation draft.
///
/// # Panics
///
/// This function does not panic. The prepared adapter reports an input-shape
/// error if it receives a non-text value.
///
/// # Parameters
///
/// - `validator`: Thread-safe validator for borrowed text with unit context.
/// - `map_error`: Converts each domain error to safe violation metadata.
///
/// # Returns
///
/// A shared prepared adapter that checks for text input before validation.