pub enum A2aVersion {
V1_0,
Unknown {
major: u16,
minor: u16,
},
}Expand description
A published A2A revision, or one published after this build was compiled.
Ordered by major then minor, oldest to newest. See the module docs for
why that is an invariant rather than a coincidence.
Ord and PartialOrd are hand-written (the derive is removed) for the
reason in the module docs: a derived Ord orders enum variants by
declaration order first, which would put V1_0 (the first variant) before
Unknown { major: 1, minor: 0 } even though they carry the same wire
value. The hand impl compares by (major, minor) only, so the two are
Ordering::Equal. The 1.98 derive fast path that assumes a derived
PartialOrd agrees with a hand-written Ord does not apply here — this
is the case the rule was written for.
Variants§
V1_0
The first A2A version with the A2A-Version header. Establishes the
JSON-RPC binding the protocol-neutral core already speaks, plus the
agent card well-known path.
Unknown
A version published after this build, identified by its Major.Minor.
Carries the same major/minor as a known revision would; what
changes between a known revision and its Unknown peer is whether
this build’s per-version codec has types for it.
Implementations§
Source§impl A2aVersion
impl A2aVersion
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
The canonical wire string, e.g. "1.0". An Unknown formats
the same way the spec defines, so the on-the-wire form does
not distinguish a known revision from a future one — the
dispatcher’s VersionNotSupportedError does.
Sourcepub const fn is_known(&self) -> bool
pub const fn is_known(&self) -> bool
True if this version is a build-time known revision. A
VersionNotSupportedError is the right response to a peer
that names a Known revision we don’t speak yet and an
Unknown we have no codec for; the dispatcher’s table
decides which side of the line a given string falls on.
Trait Implementations§
Source§impl Clone for A2aVersion
impl Clone for A2aVersion
impl Copy for A2aVersion
Source§impl Debug for A2aVersion
impl Debug for A2aVersion
Source§impl<'de> Deserialize<'de> for A2aVersion
The wire form round-trips through FromStr; a version that does
not parse is a ParseA2aVersionError, which surfaces as a serde
error so a malformed protocolVersion field is the typed answer
the spec expects, not a 500.
impl<'de> Deserialize<'de> for A2aVersion
The wire form round-trips through FromStr; a version that does
not parse is a ParseA2aVersionError, which surfaces as a serde
error so a malformed protocolVersion field is the typed answer
the spec expects, not a 500.
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for A2aVersion
impl Display for A2aVersion
impl Eq for A2aVersion
Source§impl FromStr for A2aVersion
impl FromStr for A2aVersion
Source§impl Hash for A2aVersion
impl Hash for A2aVersion
Source§impl Ord for A2aVersion
impl Ord for A2aVersion
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for A2aVersion
impl PartialEq for A2aVersion
Source§impl PartialOrd for A2aVersion
impl PartialOrd for A2aVersion
Source§impl Serialize for A2aVersion
The wire form of an A2aVersion is the Display form: "1.0",
"0.3", etc. A Serialize impl that delegates to Display keeps
the wire form and the in-memory form in lockstep — a change to
one without the other would break the protocol and the type
would catch it.
impl Serialize for A2aVersion
The wire form of an A2aVersion is the Display form: "1.0",
"0.3", etc. A Serialize impl that delegates to Display keeps
the wire form and the in-memory form in lockstep — a change to
one without the other would break the protocol and the type
would catch it.