Replace lexical Rust fragments with real modules

This commit is contained in:
ms2k 2026-07-19 05:12:57 +09:00
commit 247819250b

View file

@ -1,3 +1,13 @@
use super::confined_io::{
encode_auto_approval, encode_volume, parse_ipv4_prefix, push_bool, push_bytes,
push_sorted_list, require_pairwise_non_ancestral,
};
use super::{
ConfigurationError, ConfigurationErrorKind, ConfigurationFingerprint,
ConfigurationFingerprintRecordV1, Digest, DomainId, Sha256,
TRUSTED_HOST_CONFIGURATION_SCHEMA_ID, TrustedHostConfigurationV1,
};
/// Derives the specification-framed v1 Domain ID.
///
/// # Errors
@ -96,7 +106,7 @@ pub fn derive_configuration_fingerprint(
))
}
fn validate_structural_configuration(
pub(super) fn validate_structural_configuration(
configuration: &TrustedHostConfigurationV1,
) -> Result<(), ConfigurationError> {
if configuration.schema_id() != TRUSTED_HOST_CONFIGURATION_SCHEMA_ID {
@ -186,7 +196,7 @@ fn validate_image_reference(reference: &str) -> Result<(), ConfigurationError> {
}
}
fn validate_profile_name(name: &str) -> Result<(), ConfigurationError> {
pub(super) fn validate_profile_name(name: &str) -> Result<(), ConfigurationError> {
let bytes = name.as_bytes();
let valid = (1..=64).contains(&bytes.len())
&& bytes[0].is_ascii_alphanumeric()
@ -204,7 +214,7 @@ fn validate_profile_name(name: &str) -> Result<(), ConfigurationError> {
}
}
fn validate_environment_name(name: &str) -> Result<(), ConfigurationError> {
pub(super) fn validate_environment_name(name: &str) -> Result<(), ConfigurationError> {
let mut bytes = name.bytes();
let valid = bytes
.next()
@ -220,7 +230,7 @@ fn validate_environment_name(name: &str) -> Result<(), ConfigurationError> {
}
}
fn validate_text(value: &str, field: &str) -> Result<(), ConfigurationError> {
pub(super) fn validate_text(value: &str, field: &str) -> Result<(), ConfigurationError> {
if value.contains('\0') {
Err(ConfigurationError::new(
ConfigurationErrorKind::InvalidProfile,
@ -231,7 +241,7 @@ fn validate_text(value: &str, field: &str) -> Result<(), ConfigurationError> {
}
}
fn validate_declared_host_path(
pub(super) fn validate_declared_host_path(
declaration: &str,
allow_profile: bool,
) -> Result<(), ConfigurationError> {
@ -256,7 +266,7 @@ fn validate_declared_host_path(
validate_path_suffix(suffix)
}
fn validate_sandbox_path(path: &str) -> Result<(), ConfigurationError> {
pub(super) fn validate_sandbox_path(path: &str) -> Result<(), ConfigurationError> {
validate_text(path, "sandbox path")?;
let suffix = path.strip_prefix('/').ok_or_else(|| {
ConfigurationError::new(
@ -267,7 +277,7 @@ fn validate_sandbox_path(path: &str) -> Result<(), ConfigurationError> {
validate_path_suffix(suffix)
}
fn validate_path_suffix(suffix: &str) -> Result<(), ConfigurationError> {
pub(super) fn validate_path_suffix(suffix: &str) -> Result<(), ConfigurationError> {
if suffix.is_empty()
|| suffix.ends_with('/')
|| suffix