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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// =============================================================================
// Copyright (c) 2025 - 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Validation for non-empty dotted identifiers with ASCII letter-led segments.
use DottedIdentifierError;
/// Validates the complete dotted identifier protocol.
///
/// Every segment must start with an ASCII letter and may continue with ASCII
/// letters, digits, or underscores. Dots separate non-empty segments; leading,
/// trailing, or repeated dots are rejected. The function examines bytes so
/// non-ASCII characters cannot be accepted as letters or digits.
///
/// # Parameters
///
/// - `value`: The complete dotted identifier to validate.
///
/// # Returns
///
/// Returns `Ok(())` when every segment follows the protocol.
///
/// # Errors
///
/// Returns [`DottedIdentifierError::Empty`] for an empty identifier,
/// [`DottedIdentifierError::EmptySegment`] for a leading, trailing, or
/// repeated dot, or [`DottedIdentifierError::InvalidSegment`] when a segment
/// contains a disallowed byte or does not start with an ASCII letter.
pub const
/// Validates one segment using the protocol's ASCII character set.
///
/// `start` and `end` delimit a non-empty half-open byte range within `bytes`.
/// The first byte must be an ASCII letter. Remaining bytes may be ASCII
/// letters, digits, or underscores.
///
/// # Parameters
///
/// - `bytes`: The identifier bytes containing the segment.
/// - `start`: The inclusive start of the segment's byte range.
/// - `end`: The exclusive end of the segment's byte range.
///
/// # Returns
///
/// Returns `Ok(())` when the byte range is a valid segment.
///
/// # Errors
///
/// Returns [`DottedIdentifierError::InvalidSegment`] when the range is empty,
/// starts with a non-letter, or contains a byte outside the allowed set.
const