pub struct RoutingHeaders(/* private fields */);Expand description
A validated Mcp-Method/Mcp-Name pair, proven admissible for one session.
The profile is not stored. It is checked once, at construction, and the fact that construction succeeded is the proof — a type that could be built without a profile would be a way to skip the gate, and a type that carried the profile would let a later caller re-check a stale answer.
Implementations§
Source§impl RoutingHeaders
impl RoutingHeaders
Sourcepub fn for_profile(
target: RoutingTarget,
profile: FeatureProfile,
) -> Result<Self, RoutingHeaderError>
pub fn for_profile( target: RoutingTarget, profile: FeatureProfile, ) -> Result<Self, RoutingHeaderError>
Builds the pair, but only for a session that was offered the feature.
§Errors
RoutingHeaderError::FeatureUnavailable when the negotiated profile
does not carry Feature::StandardRoutingHeaders — that is, for every
revision before 2026-07-28, and for a 2026-07-28 session whose
profile was resolved without it.
Sourcepub fn parse<'a, I>(
fields: I,
profile: FeatureProfile,
) -> Result<Self, RoutingHeaderError>
pub fn parse<'a, I>( fields: I, profile: FeatureProfile, ) -> Result<Self, RoutingHeaderError>
Parses the pair out of a request’s header fields.
fields is whatever the HTTP layer holds, in any case, in any order.
Names are matched case-insensitively; values are not, because both values
are case-sensitive in the IR.
§Errors
RoutingHeaderError::FeatureUnavailable when the profile does not
carry Feature::StandardRoutingHeaders — checked before the fields
are even read, so a pre-2026-07-28 client is refused for the right
reason rather than for a missing header. Then
RoutingHeaderError::Missing naming whichever of the two is absent,
RoutingHeaderError::Repeated for a header sent twice, and the
value errors from MethodName::new and RoutingName::new for a
present but malformed pair.
Sourcepub const fn target(&self) -> &RoutingTarget
pub const fn target(&self) -> &RoutingTarget
What was addressed.
Sourcepub fn fields(&self) -> impl Iterator<Item = (&'static str, &str)>
pub fn fields(&self) -> impl Iterator<Item = (&'static str, &str)>
The header fields to put on the request, in the order they should go out.
One serialiser, returned as an iterator of borrowed pairs, so the adapter writes them into whatever header container it has without a second copy of the spelling existing anywhere else.