#[non_exhaustive]pub enum Method {
SendMessage,
SendStreamingMessage,
GetTask,
ListTasks,
CancelTask,
SubscribeToTask,
CreateTaskPushNotificationConfig,
GetTaskPushNotificationConfig,
ListTaskPushNotificationConfigs,
DeleteTaskPushNotificationConfig,
GetExtendedAgentCard,
}Expand description
One of the eleven A2A v1.0 service methods (spec §8).
The wire name is the PascalCase form used as the JSON-RPC method and as
the final path segment of the gRPC full method name.
use a2a_protocol_types::method::Method;
assert_eq!(Method::ALL.len(), 11);
assert_eq!(Method::SendMessage.wire_name(), "SendMessage");
assert_eq!(Method::from_wire_name("GetTask"), Some(Method::GetTask));
assert_eq!(Method::from_wire_name("message/send"), None); // v0.3 spellingVariants (Non-exhaustive)§
This enum is marked as non-exhaustive
SendMessage
Send a message and wait for the response (spec §8.1).
SendStreamingMessage
Send a message and stream events as they occur (spec §8.2).
GetTask
Fetch a task by id (spec §8.3).
ListTasks
List tasks, with optional filters and pagination (spec §8.4).
CancelTask
Request cancellation of a task (spec §8.5).
SubscribeToTask
Re-attach to an existing task’s event stream (spec §8.6).
CreateTaskPushNotificationConfig
Create a push-notification config for a task (spec §8.7).
GetTaskPushNotificationConfig
Fetch one push-notification config (spec §8.8).
ListTaskPushNotificationConfigs
List a task’s push-notification configs (spec §8.9).
DeleteTaskPushNotificationConfig
Delete a push-notification config (spec §8.10).
GetExtendedAgentCard
Fetch the authenticated extended agent card (spec §8.11, §13.3).
Implementations§
Source§impl Method
impl Method
Sourcepub const ALL: &'static [Method]
pub const ALL: &'static [Method]
Every method, in spec order.
Mirrors service A2AService in proto/a2a_v1/a2a.proto and is checked
against it by this module’s all_matches_the_ratified_proto test — see
the module docs for why the denominator is the proto and not this slice.
Exhaustiveness is separately enforced by Method::wire_name’s
match: adding a variant without adding it here fails
all_variants_are_listed rather than silently shrinking every coverage
denominator that iterates this slice.
Sourcepub fn from_wire_name(name: &str) -> Option<Method>
pub fn from_wire_name(name: &str) -> Option<Method>
Resolves a wire name, exactly. The inverse of Method::wire_name.
Deliberately case-sensitive and exact: the v0.3 spellings
(message/send, tasks/get) are not accepted, so a caller cannot
half-migrate without noticing.
Sourcepub const fn is_streaming(self) -> bool
pub const fn is_streaming(self) -> bool
true for the two methods whose response is a stream of events rather
than a single value.
Sourcepub const fn requires_push_capability(self) -> bool
pub const fn requires_push_capability(self) -> bool
true when the agent card must advertise pushNotifications for this
method to be available (spec §3.1.11 — otherwise the server answers
UnsupportedOperation).
Sourcepub const fn requires_streaming_capability(self) -> bool
pub const fn requires_streaming_capability(self) -> bool
true when the agent card must advertise streaming for this method
to be available.
Sourcepub const fn requires_extended_card_capability(self) -> bool
pub const fn requires_extended_card_capability(self) -> bool
true when the agent card must advertise extendedAgentCard.
Trait Implementations§
impl Copy for Method
impl Eq for Method
Source§impl Ord for Method
impl Ord for Method
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Method
impl PartialOrd for Method
impl StructuralPartialEq for Method
Auto Trait Implementations§
impl Freeze for Method
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnsafeUnpin for Method
impl UnwindSafe for Method
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request