mapping
Module: mapping
Section titled “Module: mapping”Contents
Section titled “Contents”Enums
ManagedMappingRuleError- A canonical snapshot rule violates the shared mapping language.
Functions
glob_match- Matchesvalueagainst a pattern where*accepts any character sequence.glob_patterns_overlap- Returns whether two*glob patterns accept at least one common string.mapping_specificity- ComputesOpenFirma’s additive mapping-rule specificity score.normalize_mapping_host- Normalizes a mapping host pattern intoOpenFirma’s canonical matching form.split_mapping_authority- Splits a mapping authority into its canonical name and optional port.validate_authored_mapping_host- Check authored authority spelling before normalization can erase intent.validate_managed_rule- Validate the canonical rule language shared by snapshot producers and consumers.
firma_core::mapping::ManagedMappingRuleError
Section titled “firma_core::mapping::ManagedMappingRuleError”Enum
A canonical snapshot rule violates the shared mapping language.
Variants:
HostMethodPathActionClass
Traits: Error, Eq, Copy
Trait Implementations:
- PartialEq
fn eq(self: &Self, other: &Self) -> bool
- Clone
fn clone(self: &Self) -> Self
- Debug
fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
- Display
fn fmt(self: &Self, __formatter: & mut ::core::fmt::Formatter) -> ::core::fmt::Result
firma_core::mapping::glob_match
Section titled “firma_core::mapping::glob_match”Function
Matches value against a pattern where * accepts any character sequence.
Wildcards cross host labels and path segments. No other character has special meaning.
fn glob_match(pattern: &str, value: &str) -> boolfirma_core::mapping::glob_patterns_overlap
Section titled “firma_core::mapping::glob_patterns_overlap”Function
Returns whether two * glob patterns accept at least one common string.
fn glob_patterns_overlap(left: &str, right: &str) -> boolfirma_core::mapping::mapping_specificity
Section titled “firma_core::mapping::mapping_specificity”Function
Computes OpenFirma’s additive mapping-rule specificity score.
fn mapping_specificity(has_method: bool, host_pattern: &str, path_pattern: Option<&str>) -> usizefirma_core::mapping::normalize_mapping_host
Section titled “firma_core::mapping::normalize_mapping_host”Function
Normalizes a mapping host pattern into OpenFirma’s canonical matching form.
Normalization trims whitespace, lowercases ASCII host text, removes DNS trailing dots, removes ports 80 and 443, and preserves other numeric ports.
fn normalize_mapping_host(host: &str) -> Stringfirma_core::mapping::split_mapping_authority
Section titled “firma_core::mapping::split_mapping_authority”Function
Splits a mapping authority into its canonical name and optional port.
This is the single authority splitter shared by host normalization,
dispatch-host normalization, and the managed mapping domain types, so the
three can never disagree on what a spelling means. The input is trimmed;
DNS names are lowercased with trailing dots removed; only an all-digit
trailing segment after the last : (or after ]: for bracketed IPv6)
counts as a port. Anything else (for example example.com:https or an
unbracketed IPv6 literal) is returned whole as the name with no port.
Intentionally not built on std::net parsers: this layer splits and
preserves spelling over a pattern language that includes * wildcards,
which no std parser accepts, while validation lives downstream in the
domain types. Parsing first would either reject wildcards or re-render
canonically, both of which change the observable normalization contract
pinned by the mapping compatibility corpus.
fn split_mapping_authority(authority: &str) -> (String, Option<String>)firma_core::mapping::validate_authored_mapping_host
Section titled “firma_core::mapping::validate_authored_mapping_host”Function
Check authored authority spelling before normalization can erase intent.
Errors
Section titled “Errors”Rejects malformed authorities, empty host names, and implicit promotion to a catch-all. Canonical snapshot validation additionally checks DNS and ports.
fn validate_authored_mapping_host(host: &str) -> Result<(), String>firma_core::mapping::validate_managed_rule
Section titled “firma_core::mapping::validate_managed_rule”Function
Validate the canonical rule language shared by snapshot producers and consumers.
Errors
Section titled “Errors”Rejects non-canonical hosts, unsupported methods, empty/oversized/NUL paths, and action classes outside the built-in registry.
fn validate_managed_rule(method: Option<&str>, host: &str, path: Option<&str>, action_class: &str) -> Result<(), ManagedMappingRuleError>