pub enum ProtocolPolicy {
Auto,
ModernOnly,
LegacyOnly,
}Expand description
Immutable policy chosen before a client connects or a server binds.
Auto remains the default policy. A policy value does not itself classify
a peer or mutate in response to peer bytes, errors, timeouts, or auth
events; transport-specific classification belongs to FND-03 integration.
Variants§
Auto
Permit both supported eras; transport-specific code classifies once.
ModernOnly
Permit only MCP 2026-07-28.
LegacyOnly
Permit only exact MCP 2024-11-05.
Implementations§
Source§impl ProtocolPolicy
impl ProtocolPolicy
Sourcepub const fn permits(self, version: ProtocolVersion) -> bool
pub const fn permits(self, version: ProtocolVersion) -> bool
Returns whether this immutable policy admits a version.
Sourcepub const fn supported_versions(self) -> &'static [ProtocolVersion]
pub const fn supported_versions(self) -> &'static [ProtocolVersion]
Returns the policy-level exact supported-version set.
This answers which eras the selected policy can operate, not which
versions a modern Streamable HTTP discovery response advertises. In
particular, Auto retains both eras here so its legacy adapter path
remains available after isolated transport classification.
Sourcepub const fn modern_discovery_versions(self) -> &'static [ProtocolVersion]
pub const fn modern_discovery_versions(self) -> &'static [ProtocolVersion]
Returns the versions advertised by modern Streamable HTTP discovery.
Legacy 2024-11-05 is selected only through the isolated legacy
transport path. It is never included inline in a modern discovery
response, including when the immutable policy is Auto.
Sourcepub const fn preferred_versions(self) -> &'static [ProtocolVersion]
pub const fn preferred_versions(self) -> &'static [ProtocolVersion]
Returns the client preference order for this policy.
Auto prefers the modern revision first; a fallback decision is owned by the isolated client-negotiation layer, never by this value type.
Sourcepub const fn requires_legacy_adapter(self) -> bool
pub const fn requires_legacy_adapter(self) -> bool
Returns whether using this policy requires a legacy adapter receipt.
Sourcepub fn validate_for_client(
self,
legacy_receipt: Option<&LegacyClientAdapterInstalledReceipt>,
) -> Result<ProtocolPolicySelection, ProtocolPolicyError>
pub fn validate_for_client( self, legacy_receipt: Option<&LegacyClientAdapterInstalledReceipt>, ) -> Result<ProtocolPolicySelection, ProtocolPolicyError>
Validates a client policy before any connect-side effect.
Sourcepub fn validate_for_server(
self,
legacy_receipt: Option<&LegacyServerAdapterInstalledReceipt>,
) -> Result<ProtocolPolicySelection, ProtocolPolicyError>
pub fn validate_for_server( self, legacy_receipt: Option<&LegacyServerAdapterInstalledReceipt>, ) -> Result<ProtocolPolicySelection, ProtocolPolicyError>
Validates a server policy before any bind-side effect.
Trait Implementations§
Source§impl Clone for ProtocolPolicy
impl Clone for ProtocolPolicy
Source§fn clone(&self) -> ProtocolPolicy
fn clone(&self) -> ProtocolPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ProtocolPolicy
Source§impl Debug for ProtocolPolicy
impl Debug for ProtocolPolicy
Source§impl Default for ProtocolPolicy
impl Default for ProtocolPolicy
Source§fn default() -> ProtocolPolicy
fn default() -> ProtocolPolicy
Source§impl<'de> Deserialize<'de> for ProtocolPolicy
impl<'de> Deserialize<'de> for ProtocolPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ProtocolPolicy
Source§impl Hash for ProtocolPolicy
impl Hash for ProtocolPolicy
Source§impl PartialEq for ProtocolPolicy
impl PartialEq for ProtocolPolicy
Source§impl Serialize for ProtocolPolicy
impl Serialize for ProtocolPolicy
impl StructuralPartialEq for ProtocolPolicy
Auto Trait Implementations§
impl Freeze for ProtocolPolicy
impl RefUnwindSafe for ProtocolPolicy
impl Send for ProtocolPolicy
impl Sync for ProtocolPolicy
impl Unpin for ProtocolPolicy
impl UnsafeUnpin for ProtocolPolicy
impl UnwindSafe for ProtocolPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.